Matching pattern on incoming calls

Hello Folks at Asterisk Community,

First time here, I was also registered at the old forums.

I am using “Pattern Matching” to choose which one of the two telephony services (from different providers) to use for outbound calls on a 1.8 Asterisk PBX.
This is working as it should and I have 20 different patterns.

Now I need to do the same for incoming calls, identify if the CALLERID matches with one of the providers or the other, but there is also the possibility to do it with REGEX.

Which one would be the best way to accomplish this? REGEX or Pattern Matching?


The one who you think it is easier for you. there are millions of ways

GotoIf($[${CALLERID(num)} !=’’]?inconming,${CALLERID(num)},1)



The built in pattern matching is likely to be more efficient, but efficiency may not be a real issue.


Thanks for the reply.
I was thinking on using the same patterns but it is not working as it should.
This page of docs says this should work: same => n/_7XXXXXXX,Goto(anotherSection)
It’s a must to use it on the first line of a section?

Like this:

exten => s/_480NXXXXXX,1,Goto(RING)
exten => s/_520NXXXXXX,1,Goto(RING)
exten => s/_602NXXXXXX,1,Goto(RING)
exten => s/_623NXXXXXX,1,Goto(RING)
exten => s/_928NXXXXXX,1,Goto(RING)
exten => s,1,NoOP()
 same => n,Progress()
 same => n,Ringing()
 same => n,Wait(16)
 same => n,Hangup()
1 Like