开发者

asterisk anti ex-girlfriend Dial plan?

I wrote simple dial plan in asterisk. This dial-plan target is to check caller-id of incoming call and for specific hangup :) !

but this dial-plan hangup all incoming call with diffrent caller-id.

So what do i do? ;(

   [general]  
    static=yes  
    writeprotect=yes  
    autofallthrough=yes  
    clearglobalvars=no  
    priorityjumping=yes  
    include "exten_gvars.inc"  

    [macro-queue]
    exten => s, 1, Queue(${ARG1})

    [default]  
    exten => s, 1, Answer  
    exten => s/9999, 2 ,Hangup  
    exten => s, 2, BackGround(welcome)  
    exten => s,开发者_运维知识库 3, Macro(queue,operator)  

Edit

i change my dial plan to this but it not working, incoming call hangup after two beep(i know it occur cuz a mistake in my dial plan)!

    [general]
static=yes
writeprotect=yes
autofallthrough=yes
clearglobalvars=no
priorityjumping=yes
#include "exten_gvars.inc"

[macro-monitor]
exten => s, 1, MixMonitor(${UNIQUEID}.wav)
exten => s, 2, SetCIDName(${UNIQUEID}#${CALLERIDNAME},a)

[macro-defaultLine]
exten => s, 1, Macro(monitor)
exten => s, 2, Dial(SIP/${ARG1},60,T)

[macro-queue]
exten => s, 1, Macro(monitor)
exten => s, 2, Queue(${ARG1})

[inbound]
exten => _XX, 1, Macro(defaultLine,${EXTEN})

[default]
exten => 123,1,GotoIf($[${CALLERID(num)} = XX]?reject:allow)
exten => 123,n(allow),Answer
exten => 123,n,BackGround(welcome)
exten => 123,n,Macro(queue,operator)
exten => 123,n(reject),BackGround(WTF)
exten => 123,n,Hangup()
include => inbound


Here is your anti ex-girlfriend Dailplan, assuming xxxxx is your ex-girlfriends number

exten => 123,1,GotoIf($[${CALLERID(num)} = xxxxx]?reject:allow)
exten => 123,n(allow),Dial(Zap/4)
exten => 123,n,Hangup()
exten => 123,n(reject),Playback(abandon-all-hope)
exten => 123,n,Hangup()

Hope this helps you


You do not have a step 2 for other callerids and autofalltrhough is enabled, which means (in 1.6) that the call will be dropped after step 1.

[default]
exten => s, 1, Answer
exten => s/9999, 2 ,Hangup
exten => s, 2, NoOp  
exten => s, 3, BackGround(welcome)
exten => s, 4, Macro(queue,operator) 

Edit: Are you sure the callerID is EXACTELLY 9999? Try replacing that line with

exten => s, 2, NoOp((${CALLERID(all)})

then look in the console and see what the callerID is.

use:

 asterisk -r 

then enter:

 core set verbose 5

also, enter:

show dialplan

and see if the dialplan is correctly loaded into asterisk


First of all, it would appear that you don't really understand how the Asterisk dialplan works. The code block you put up there is just plain wrong, Asterisk won't complain - as dialplan isn't supposed to do so.

Let's examine one by one:

[macro-queue]
exten => s, 1, Queue(${ARG1})

[default]  
exten => s, 1, Answer  
exten => s/9999, 2 ,Hangup  
exten => s, 2, BackGround(welcome)  
exten => s, 3, Macro(queue,operator)  

The reason the above is wrong is due to the fact that you can't put a CALLERID matching on a single line of the extension - it's should be all the way. So technically, you would need:

[macro-queue]
exten => s, 1, Queue(${ARG1})

[default]  
exten => s/9999, 1, Answer  
exten => s/9999, 2 ,Hangup  
exten => s/9999, 2, BackGround(welcome)  
exten => s/9999, 3, Hangup 

exten => s, 1, Answer  
exten => s, 2 ,Hangup  
exten => s, 2, BackGround(welcome)  
exten => s, 3, Macro(queue,operator)  

Now, that isn't a proper way of doing this - simply because you'll be replicating lines over and over again. The right way of doing it is very much similar to the previous answer, however, this is what I would do:

exten => s, 1, Answer
exten => s, n, Gotoif($["${CALLERID(num)}" = "9999"]?reject:continue)
exten => s, n(continue), Background(Welcome)
exten => s, n, Macro(queue, operator)
exten => s, n(reject), Hangup()

Now, you can extend the various CALLERID numbers you want to block. Again, assuming this is the result you were looking to achieve.


It's quite simple:

[default]  
    exten => s/9999,1,Hangup  

    exten => s,1,Answer  
    exten => s,2,BackGround(welcome)  
    exten => s,3,Macro(queue,operator)  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜