Question : Asterisk Dialplan Problem

Hi All,

I have an Aserisk server that is running a couple of internal extensions and also trunking calls through to MyNetFone (just a standard SIP provider). I have all the trunking working just fine, and I am able to call out using the SIP provider.

The problem is that the phones are unnable to call internal extensions (2XX & 5XX). Call calls are being forwarded to the VOIP provider. I have added the internal extenstions to a context called "internal" (see below), and then I have included that context before hte line that forwards "all calls" to the VOIP provider.

If I add the internal extensions manually and remove hte include line it works, but I wold rather only declare these extensions once and include them. Where am I going wrong? Its worth noting that the device we are calling from is using the [outgoingpots] context.

The Desired outcome is that any phone using the [outogingpots] context can call 2XX & 5XX extensions and have every other number being sent direct to VOIP provider. Can anyone shed some light on where I have gone wrong?
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
[internal]
exten => _501,1,Dial(SIP/501)
exten => _502,1,Dial(SIP/spa3000)
exten => _2XX,1,Dial(SIP/${EXTEN}@192.168.10.10,60,t)
 
exten => _0.,1,Dial(SIP/${EXTEN:1}@MyNetFone1,30)
exten => _0.,2,Congestion
exten => _0.,102,Busy
 
[outgoingpots]
include=internal
 
exten => _.,1,Dial(SIP/${EXTEN}@MyNetFone1,30)
exten => _.,2,Congestion
exten => _.,102,Busy

Answer : Asterisk Dialplan Problem

The rules about precedence of one pattern over another are slightly obscure. See the section "Controlling sort order" in this link:
http://www.voip-info.org/wiki/view/Asterisk+config+extensions.conf+sorting

You therefore have two choices:
1. Put all sections into separate contexts and then use a series of include statements to force them to be tested in the correct sequential order. See snippet for example of this.
2. Identify a pattern that is clearly going to be unique and does not overlap the 2xx and 5xx numbers, yet is broad ranging enough to be a catch-all for any valid number that users might otherwise dial. For example, if all the other numbers are at least 5 digits long, use _XXXX.    OR  if all the other numbers start with 0,1,3,4,6,7 or 8 then the pattern _[01346-8]. will match these.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
[internal]
exten => _501,1,Dial(SIP/501)
exten => _502,1,Dial(SIP/spa3000)
exten => _2XX,1,Dial(SIP/${EXTEN}@192.168.10.10,60,t)
 
[catchall]
exten => _X.,1,Dial(SIP/${EXTEN:1}@MyNetFone1,30)
exten => _X.,2,Congestion
exten => _X.,102,Busy
 
[outgoingpots]
include=internal
include=catchall
 
Random Solutions  
 
programming4us programming4us