Incoming SIP Call form a 3rd party

I am tying to send an incoming call with a following caller ID 15164360619
to and extesion on my asterisk server i am using the following code but it fails.

 exten => s,1,Answer
 exten => 15164360619,1,Dial(IAX2/fAS-NY17S/2022) 

Now this one works and the caller ID that come up on my phone is 15164360619.

 exten => s,1,Answer 
 exten => s,2,Dial(IAX2/fas-NY17S/2022) 

Why does the first set fail? What am i doing wrong?

if you are wanting to route the call based on the caller id the try this

voip-info.org/wiki/view/Asterisk+cmd+GotoIf

[quote=“rusty”]if you are wanting to route the call based on the caller id the try this

voip-info.org/wiki/view/Asterisk+cmd+GotoIf[/quote]


That did not work either.

exten => s,1,Answer                     ; Answer the line
exten => 2022,1,GotoIf($["${CALLERIDNUM}" = "15164360619"]?3:2)

Do you have the set ${CALLERIDNUM} somewhere?

Here is mine I had to play with it to make it work right
I use this to route calls to different stores based on the caller id

[incoming]
exten => 7111111111,1,GoTo(dish5,s,1)

I use this to match teh areacode
[dish5]
exten => s,1,NoOP(${CALLERID})
exten => s,2,GotoIf($["${CALLERIDNUM:0:3}" = “270”]?dish270,s,1:3)
exten => s,3,GotoIf($["${CALLERIDNUM:0:3}" = “731”]?dish731,s,1:4)
exten => s,4,Goto(ucdish,s,1)

Then this to match the nxx
[dish270]
exten => s,1,GotoIf($["${CALLERIDNUM:0:6}" = “270207”]?ucdish,s,1)
exten => s,2,GotoIf($["${CALLERIDNUM:0:6}" = “270214”]?ucdish,s,1)
exten => s,21,GotoIf($["${CALLERIDNUM:0:6}" = “270883”]?mdish,s,1:pdish,s,1)

[dish731]
exten => s,1,GotoIf($["${CALLERIDNUM:0:6}" = “731214”]?mdish,s,1)
exten => s,2,GotoIf($["${CALLERIDNUM:0:6}" = “731218”]?mdish,s,1)
exten => s,3,GotoIf($["${CALLERIDNUM:0:6}" = “731223”]?mdish,s,1)
exten => s,4,GotoIf($["${CALLERIDNUM:0:6}" = “731973”]?mdish,s,1:ucdish,s,1)
[pdish]
exten => s,1,Dial(IAX2/net/2701111111)
;
[ucdish]
exten => s,1,Dial(Zap/25&Zap/30&Zap/31&Zap/39&Zap/68&Zap/69&Zap/70&Zap/71&Zap/72,25)
exten => s,2,Voicemail(710)
;
[mdish]
exten => s,1,Dial(IAX2/net/7315111111)

So instead of going to and ext u are sending it to a context.

Is that what makes the difference?

Is that what makes the difference?

Not for sure about that its just easier for me going threw the Dial plan mines getting pretty big and I can use the context for differnt things.

The trick is once you get it to match the caller id you can do whatever you want with