我为来电实施了一个简单的黑名单。我遇到的问题是,当黑名单通话时我的手机不再响铃(此部分很好),但黑名单手机不会挂断(这就是问题所在)。
extensions.conf中的传入上下文:
exten => 12225551234,1,Zapateller(nocallerid)
same => n,GotoIf(${BLACKLIST()}?hangup)
same => n,Dial(SIP/myphone)
same => n(hangup),Hangup()
在黑名单中添加一个号码:
CLI> database put blacklist +14445554321 "Blacklisted for testing"
从黑名单14445554321致电12225551234 ......
通过CLI界面看到:
== Using SIP RTP CoS mark 5
-- Executing [12225551234@from-sipProvider:1] GotoIf("SIP/sipProvider_did9-00000738", "1?hangup") in new stack
-- Goto (from-sipProvider,12225551234,5)
-- Executing [12225551234@from-sipProvider:5] Hangup("SIP/sipProvider_did9-00000738", "") in new stack
== Spawn extension (from-sipProvider, 12225551234, 5) exited non-zero on 'SIP/sipProvider_did9-00000738'
== Using SIP RTP CoS mark 5
-- Executing [12225551234@from-sipProvider:1] GotoIf("SIP/sipProvider_did10-00000739", "1?hangup") in new stack
-- Goto (from-sipProvider,12225551234,5)
-- Executing [12225551234@from-sipProvider:5] Hangup("SIP/sipProvider_did10-00000739", "") in new stack
== Spawn extension (from-sipProvider, 12225551234, 5) exited non-zero on 'SIP/sipProvider_did10-00000739'
== Using SIP RTP CoS mark 5
-- Executing [12225551234@from-sipProvider:1] GotoIf("SIP/sipProvider_did9-0000073a", "1?hangup") in new stack
-- Goto (from-sipProvider,12225551234,5)
-- Executing [12225551234@from-sipProvider:5] Hangup("SIP/sipProvider_did9-0000073a", "") in new stack
== Spawn extension (from-sipProvider, 12225551234, 5) exited non-zero on 'SIP/sipProvider_did9-0000073a'
这一直持续到被阻止的呼叫者挂断为止。最终,大约50秒后,如果来电者没有挂断电话,他会听到铃声响起。我需要挂断电话,否则如果他将手机放下电话我会被收费。
答案 0 :(得分:1)
在挂机前尝试接听电话。这就是我使用的:
exten => 12225551234,1,Zapateller(nocallerid)
same => n,GotoIf(${BLACKLIST()}?badlist,s,1)
same => n,Dial(SIP/myphone)
same => n,Hangup()
[badlist]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup