[Asterisk-Users] dialplan selection

Reid Forrest rforrest at max-is.net
Sun Dec 19 14:08:34 MST 2004



> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com 
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of 
> Samudra E. Haque
> Sent: Sunday, December 19, 2004 12:58 PM
> To: asterisk-users at lists.digium.com
> Subject: [Asterisk-Users] dialplan selection
> 
> Hello,
> 
> I would like to parse inbound Asterisk IAX2 7-digit numbers 
> in the form of
> 123-4567 and strip out the first four digits, and then dial 
> whatever number
> digits remain. If I only have three digits (000-999) and have a mix of
> channels (ZAP, SIP, IAX2) could someone please point out how 
> I can use a
> single DIAL command to just dial the extension regardless of 
> the type of
> channel. .. For each valid extension, I have a separate dial 
> command anyway,
> which denotes the particular channel that extension is assigned to.
> 
> I do not want to assign groups of extensions i.e., 123-A567 
> or 123-B567 or
> 123-C567 where A=ZAP, B=SIP, C=IAX2 peers respectively.
> 

Samudra,
If I understand you correctly, you're not just looking to strip digits, but
dial an arbitrary extension without specifying the channel type in the dial
command. correct?

You should be able to accomplish this using a variable for each extension.
For example:

[globals]
X1000=SIP/1000
X1001=ZAP/1001
X1002=IAX2/1002
X1003=SIP/1003

[outbound]
exten => _123XXXX,1,Dial(${X${EXTEN:4}},10)

If the user dials 1231002, then Dial(IAX2/1002,10) should be executed.
If you have a lot of extensions then you should be able to put the variables
into a database instead.

Reid




More information about the asterisk-users mailing list