tags:

views:

38

answers:

2

Hello,

In my dialplan , i have an extension for _XXXXXXX (for 7 digit numbers) and an extension for _X. . Now, if i i dial a 7 digit number , the _X. extension is getting executed instead of _XXXXXXX. I would like the _XXXXXXX part to get executed in case a 7 digit number is dialed. Any way to fix this ?

Thank You.

A: 

I think the explanations at this link will help you. In a nutshell, it appears that Asterisk reorders dialplans and does this differently for 1.2 and 1.4.

As far as I can see, the easiest, the most portable and the most clean cut solution to your problem is to define the _XXXXXXX (7 digit number) in one context and the _X. in another. Then, you need to include the second context in the first.

A very quick example:

[seven-digit]
include => match-all
exten => h,1,Hangup
exten => _XXXXXXX,1,Dial(Zap/1/${EXTEN})

[match-all]
exten => _X.,1,Dial(Zap/2/${EXTEN})
paracycle
+1  A: 

_X. is a rather dangerous item to have in your dialplan in general, since it basically matches everything. Try to avoid using it, and come up with more specific dial rules.

You may want to modify the 7-digit line to be _NXXXXXX instead, if you're dialing real phone numbers this way.

If you have a set number of extensions for the other phones within your location, and you use Asterisk to dial out to the phone system cloud, you can do something like this (assuming your area code is 321, and your local extensions have three digits and start with 7):

exten => _1NXXNXXXXXX,1,Dial(SIP/trunk/${EXTEN})
exten => _NXXNXXXXXX,1,Dial(SIP/trunk/1${EXTEN})
exten => _NXXXXXX,1,Dial(SIP/trunk/1321${EXTEN})
;local extension(s)
exten => _7XX,1,Dial(SIP/${EXTEN})
Naikrovek
I think it is '_.' extension which is 'dangerous' because it will match 'everything', including the special extensions like t, h, i, s, etc. _X. will not match those special extensions.
kinjal