Dialplans for local and normal calls?

I am trying to figure out how to dial out with 10-digit numbers and 7-digit numbers in addition to my 11-digit (1+area code+number) setup. I cannot seem to get this right. What am I doing wrong? It keeps telling me that the seven or ten-digit number does not exist.

exten => _1NXXNXXXXXX,1,Dial(SIP/nextiva/${EXTEN:1},120)
exten => _1NXXNXXXXXX,n,Hangup()

exten => NXXNXXXXXX,1,Dial(SIP/nextiva/1${EXTEN:1},120)
exten => NXXNXXXXXX,n,Hangup()

exten => NXXXXXX,1,Dial(SIP/nextiva/1910${EXTEN:1},120)
exten => NXXXXXX,n,Hangup()

The first match works, the second two do not appear to work. My old setup is below, which requires a user to dial 9 to get out of the building. It works.

; Old config
;exten => _9XXXX.,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to ${EXTEN:1}$
;exten => _9XXXX.,n,Dial(SIP/nextiva/${EXTEN:1},120)
;exten => _9XXXX.,n,Playtones(congestion)
;exten => _9XXXX.,n,Hangup()

Missing _

Call me an idiot, I did not catch that. It was a LONG day yesterday. Thanks for the tip, I will make the change now and let you know if it fails to fix my issue. Thank you!

UPDATE

That got me farther, but something isn’t right. If I dial a 7-digit number (local) I get a busy tone every time. If I dial a 10-digit number I get a recording that the number has been disconnected. Again, here is my setup.

exten => _1NXXNXXXXXX,1,Dial(SIP/nextiva/${EXTEN:1},120)
exten => _1NXXNXXXXXX,n,Hangup()

exten => _NXXNXXXXXX,1,Dial(SIP/nextiva/1${EXTEN:1},120)
exten => _NXXNXXXXXX,n,Hangup()

exten => _NXXXXXX,1,Dial(SIP/nextiva/1910${EXTEN:1},120)
exten => _NXXXXXX,n,Hangup()

The “nextiva” is the name of the section of my trunk. Maybe I have the dial section wrong? Below is the “nextiva” section in sip.conf.

[nextiva]
type=friend
secret=<hidden>
username=<hidden>
host=bt.voipdnsservers.com
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
allow=gsm
insecure=port,invite
fromuser=<this is my ten-digit phone number>
fromdomain=bt.voipdnsservers.com
context=incoming

Thanks for the help.

Verbose level 5 logs please. You may also need to enable sip debug output.

David, I turned on core verbose 5 and SIP debugging, then tried making half a dozen calls to local numbers, which resulted in a busy tone each time (number was my cellular phone, not busy). The logs show nothing new though. How do I get it to log the new stuff?

If you’re wondering, I logged into the console using “asterisk -r”, then issued “core set verbose 5” followed by “sip set debug on”. I then quit the console and started making 10-digit and 7-digit calls. All 7-digit calls get a busy tone. All 10-digit calls get a recording to check my number and try again.

I have it working. It was the dialplan. Assume my cell number is 123-456-7890. First I called the 7-digit version, then the 10-digit version, and finally the 11-digit version. All worked, but the 11-digit one I cannot figure out. It dials 10-digits instead of all 11. It works, but is not correct. Check the logs below. I censored my name, number, and extension in the logs.

[Jul 31 09:47:27] NOTICE[18331] Ext. 4567890:  Dialing out from "Hidden Desk" <X> to 11234567890 through Nextiva
[Jul 31 09:47:43] NOTICE[18336] Ext. 1234567890:  Dialing out from "Hidden Desk" <X> to 11234567890 through Nextiva
[Jul 31 09:48:03] NOTICE[18378] Ext. 11234567890:  Dialing out from "Hidden Desk" <X> to 1234567890 through Nextiva

Here is the current dialplan.

; 11-digit full numbers with country code
exten => _1NXXNXXXXXX,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to ${EXTEN:1} through Nextiva)
exten => _1NXXNXXXXXX,2,Dial(SIP/nextiva/${EXTEN:1},120)
exten => _1NXXNXXXXXX,n,Hangup()

; 10-digit cell-style numbers
exten => _NXXNXXXXXX,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to 1${EXTEN} through Nextiva)
exten => _NXXNXXXXXX,2,Dial(SIP/nextiva/1${EXTEN},120)
exten => _NXXNXXXXXX,n,Hangup()

; 7-digit local numbers
exten => _NXXXXXX,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to 1910${EXTEN} through Nextiva)
exten => _NXXXXXX,2,Dial(SIP/nextiva/1910${EXTEN},120)
exten => _NXXXXXX,n,Hangup()

I am not sure what is up here. Advice?

UPDATE

Fixed it. I forgot to remove “:1” from my variable. All is good now! For others who may need help, here is my dialplan.

; 11-digit full numbers with country code
exten => _1NXXNXXXXXX,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to ${EXTEN} through Nextiva)
exten => _1NXXNXXXXXX,2,Dial(SIP/nextiva/${EXTEN},120)
exten => _1NXXNXXXXXX,n,Playtones(congestion)
exten => _1NXXNXXXXXX,n,Hangup()

; 10-digit cell-style numbers
exten => _NXXNXXXXXX,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to 1${EXTEN} through Nextiva)
exten => _NXXNXXXXXX,2,Dial(SIP/nextiva/1${EXTEN},120)
exten => _NXXNXXXXXX,n,Playtones(congestion)
exten => _NXXNXXXXXX,n,Hangup()

; 7-digit local numbers
exten => _NXXXXXX,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to 1910${EXTEN} through Nextiva)
exten => _NXXXXXX,2,Dial(SIP/nextiva/1910${EXTEN},120)
exten => _NXXXXXX,n,Playtones(congestion)
exten => _NXXXXXX,n,Hangup()

Note that my country is the United States and my area code is 910, hence the “1910${EXTEN}” on the local numbers and the “1${EXTEN}” on the 10-digit numbers. Adjust to your needs and it should work.

Your logging level is too low.

Enable the full log in logger.conf. Do core set verbose 5, core set debug 5, and sip set debug on.

It is OK now. It works as intended. It was the programming error in my extensions.conf causing the issue. I am now having a problem configuring an IVR, but that is for a new thread. Thank you for the help!