I’m quite new to Asterisk, so I’m sorry if the question is quite stupid
I\m running Asterisk Asterisk 1.8.18.0. I set up Asterisk to block all outgoing calls except some predefined destinations. I also add default code for local calls if it wasn’t specified by user. So I have following lines in my extensions.conf:
[outbound]
exten => _XXXXXXX,1,GoTo(8351${EXTEN},1)
exten => _[78]35[12].,1,NoOp()
same => n,Dial(SIP/sipnet/98${EXTEN:1},60,TM(answer))
same => n,Hangup
Now I need to add another outbound pattern which is completely different, it is 8800XXXXXXX. What do I need to add to my configuraion? Thanks for your help in advance.
Thanks a lot! Yes, I already tried to add the new pattern to the second line, so my config file looks like this:
[outbound]
exten => _XXXXXXX,1,GoTo(8351${EXTEN},1)
exten => _[78]35[12].,1,NoOp()
exten => _8800XXXXXXX,1,NoOp()
same => n,Dial(SIP/sipnet/98${EXTEN:1},60,TM(answer))
same => n,Hangup
But it doesn’t work as expected because as you said I need to use wildcards for the last two lines. What did you mean by this?
Thanks for the link, this manual is really clear and understandable. So If I got it right I can just repeat the last two lines for the new pattern and get the config like this:
[outbound]
exten => _XXXXXXX,1,GoTo(8351${EXTEN},1)
exten => _[78]35[12].,1,NoOp()
same => n,Dial(SIP/sipnet/98${EXTEN:1},60,TM(answer))
same => n,Hangup
exten => _8800XXXXXXX,1,NoOp()
same => n,Dial(SIP/sipnet/98${EXTEN:1},60,TM(answer))
same => n,Hangup
It’s quite straightforward, but it doesn’t look neat. I read about macros and wrote the following:
[outbound]
exten => _XXXXXXX,1,GoTo(8351${EXTEN},1)
exten => _[78]35[12].,1,Macro(macro-dial,${EXTEN})
exten => _8800XXXXXXX,1,Macro(macro-dial,${EXTEN})
I thought about using _X. pattern for the last two lines. However, what I couldn’t realize is that if I set priority “n” this extension will be used only if one of the previous patterns were matched. Thank you very much for helping me to understand the logic here!