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)