Different Extensions -> Outbound Routes?


#1

Hi all,

Just thought I’d check up with the Asterisk gurus here regarding something I’d like to get working on my Asterisk box, but can’t seem to find the mechanism to do it (well, the option is not in AMP - but I’m hoping this is something I can still do with .conf editing).

Pretty simple request - I’d like certain extensions to use certain outbound routes, but not others, for example, so I can get extension 100 to default to one SIP provider’s route, and 101 to default to a different provider’s route. Is this possible?

Thanks for any input or advice! :smile:


#2

Read up on the GotoIf command. Something like

exten => s,1,GotoIf($["${EXTEN}" = “100”]?2:4)
exten => s,2,Dial(SIP/provider1)
exten => s,3,Hangup
exten => s,4,GotoIf($["${EXTEN}" = “101”]?5:7)
exten => s,5,Dial(SIP/provider1)
exten => s,6,Hangup
exten => s,7,Dial(someother way)
exten => s,8,Hangup


#3

Instead of having diffrent extensions for diffrent routes you can use pattern matching.

Exten => _XXXXXXXXXX,1,Dial(SIP/${EXTEN}@Provider1)

Exten => _800XXXXXXX,1,Dial(SIP/${EXTEN}@Provider2)

Exten => _011.,1,Dial(SIP/${EXTEN}@Provider3)