Need help with extensions.conf/dialplan

Ok so I’m having some difficulties dialing out. Soon as I press 1 digit it just goes to a fast busy.

Of note, Asterisk is setup as a 1to1 NAT behind a pfsense firewall, which handles all the NAT, in theory, which is why it’s disabled currently.

Here is my extensions.conf:

[from-trunk]
exten => s,1,Dial(SIP/301,15)
exten => s,2,Dial(SIP/1VoIP/mycellphonehere,15)
exten => s,3,Voicemail(${EXTEN})
exten => s,4,Hangup()

[internal]
exten => _XXXXXXXXXX,1,Dial(SIP/${EXTEN}@1VoIP)
exten => _XXXXXXXXXX,2,congestion()
exten => _XXXXXXXXXX,102,busy()

exten => _1XXXXXXXXXX,1,Dial(SIP/${EXTEN}@1VoIP)
exten => _1XXXXXXXXXX,2,congestion()
exten => _1XXXXXXXXXX,102,busy()

exten => _XXX,1,(SIP/${EXTEN})

and sip.conf, if needed

[general]
bindaddr=10.9.9.2
;externip=x.x.x.x (External Static)
;localnet=10.9.9.0/255.255.255.240
nat=no
allowguest=no
disallow=all
allow=ulaw
srvlookup=yes
tcpenable=no
defaultexpiry=3600
directmedia=no
transport=udp
qualify=yes

register => sipline:xxx@siphost

[1VoIP]
type=peer
context=from-trunk
host=x.x.x.x
;username=xxxxxxx
fromuser=xxxxxxx
secret=xxx
insecure=invite
canreinvite=no
disallow=all
allow=ulaw
dtmfmode=rfc2833
fromdomain=x.x.x.x
;qualify=yes
;maxexpiry=3600
;minexpiry=30

[301]
type=friend
host=dynamic
secret=xxx
context=internal
nat=no
dtmfmode=rfc2833
canreinvite=no
callerid=300
;qualify=yes

[302]
type=friend
host=dynamic
secret=xxx
context=internal
nat=no
dtmfmode=rfc2833
canreinvite=no
callerid=301
;qualify=yes

Console output of a failed call is really needed to tell what is going on.

I can point out that your final line of your Internal context is malformed and will not work.

Yeah I was trying to make it so if you dial 3 numbers it’ll ring that extension.

Here is my debug:

<— SIP read from UDP:10.9.9.4:49169 —>
INVITE sip:1@10.9.9.2;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.9.9.4:5060;branch=z9hG4bKca02ff36
From: “301” sip:301@10.9.9.2;tag=00229005b18d038f91f89dba-deb14ca6
To: sip:1@10.9.9.2;user=phone
Call-ID: 00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4
Max-Forwards: 70
Date: Wed, 08 Nov 2017 22:26:06 GMT
CSeq: 101 INVITE
User-Agent: Cisco-CP7961G/8.5.3
Contact: sip:301@10.9.9.4:5060;transport=udp
Expires: 180
Accept: application/sdp
Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
Remote-Party-ID: “301” sip:301@10.9.9.2;party=calling;id-type=subscriber;privacy=off;screen=yes
Supported: replaces,join,norefersub
Allow-Events: kpml,dialog
Content-Length: 267
Content-Type: application/sdp
Content-Disposition: session;handling=optional

v=0
o=Cisco-SIPUA 1049 0 IN IP4 10.9.9.4
s=SIP Call
t=0 0
m=audio 16714 RTP/AVP 0 8 18 101
c=IN IP4 10.9.9.4
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
— (19 headers 13 lines) —
Sending to 10.9.9.4:5060 (no NAT)
Using INVITE request as basis request - 00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4
Found peer ‘301’ for ‘301’ from 10.9.9.4:49169

<— Reliably Transmitting (no NAT) to 10.9.9.4:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.9.9.4:5060;branch=z9hG4bKca02ff36;received=10.9.9.4
From: “301” sip:301@10.9.9.2;tag=00229005b18d038f91f89dba-deb14ca6
To: sip:1@10.9.9.2;user=phone;tag=as1b718c0a
Call-ID: 00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4
CSeq: 101 INVITE
Server: Asterisk PBX 1.8.32.3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="0d6a64de"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4’ in 6400 ms (Method: INVITE)

<— SIP read from UDP:10.9.9.4:50101 —>
ACK sip:1@10.9.9.2;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.9.9.4:5060;branch=z9hG4bKca02ff36
From: “301” sip:301@10.9.9.2;tag=00229005b18d038f91f89dba-deb14ca6
To: sip:1@10.9.9.2;user=phone;tag=as1b718c0a
Call-ID: 00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4
Date: Wed, 08 Nov 2017 22:26:06 GMT
CSeq: 101 ACK
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:10.9.9.4:49169 —>
INVITE sip:1@10.9.9.2;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.9.9.4:5060;branch=z9hG4bKd209b56a
From: “301” sip:301@10.9.9.2;tag=00229005b18d038f91f89dba-deb14ca6
To: sip:1@10.9.9.2;user=phone
Call-ID: 00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4
Max-Forwards: 70
Date: Wed, 08 Nov 2017 22:26:06 GMT
CSeq: 102 INVITE
User-Agent: Cisco-CP7961G/8.5.3
Contact: sip:301@10.9.9.4:5060;transport=udp
Authorization: Digest username=“301”,realm=“asterisk”,uri="sip:1@10.9.9.2;user=phone",response=“ffd7a5b10f8e03914646103aea91536d”,nonce=“0d6a64de”,algorithm=MD5
Expires: 180
Accept: application/sdp
Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
Remote-Party-ID: “301” sip:301@10.9.9.2;party=calling;id-type=subscriber;privacy=off;screen=yes
Supported: replaces,join,norefersub
Allow-Events: kpml,dialog
Content-Length: 267
Content-Type: application/sdp
Content-Disposition: session;handling=optional

v=0
o=Cisco-SIPUA 1049 0 IN IP4 10.9.9.4
s=SIP Call
t=0 0
m=audio 16714 RTP/AVP 0 8 18 101
c=IN IP4 10.9.9.4
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
— (20 headers 13 lines) —
Sending to 10.9.9.4:5060 (no NAT)
Using INVITE request as basis request - 00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4
Found peer ‘301’ for ‘301’ from 10.9.9.4:49169
== Using SIP RTP CoS mark 5
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 18
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format G729 for ID 18
Found audio description format telephone-event for ID 101
Capabilities: us - 0x4 (ulaw), peer - audio=0x10c (ulaw|alaw|g729)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x4 (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 10.9.9.4:16714
Looking for 1 in internal (domain 10.9.9.2)

<— Reliably Transmitting (no NAT) to 10.9.9.4:5060 —>
SIP/2.0 484 Address Incomplete
Via: SIP/2.0/UDP 10.9.9.4:5060;branch=z9hG4bKd209b56a;received=10.9.9.4
From: “301” sip:301@10.9.9.2;tag=00229005b18d038f91f89dba-deb14ca6
To: sip:1@10.9.9.2;user=phone;tag=as1b718c0a
Call-ID: 00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4
CSeq: 102 INVITE
Server: Asterisk PBX 1.8.32.3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4’ in 6400 ms (Method: INVITE)

<— SIP read from UDP:10.9.9.4:50102 —>
ACK sip:1@10.9.9.2;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.9.9.4:5060;branch=z9hG4bKd209b56a
From: “301” sip:301@10.9.9.2;tag=00229005b18d038f91f89dba-deb14ca6
To: sip:1@10.9.9.2;user=phone;tag=as1b718c0a
Call-ID: 00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4
Date: Wed, 08 Nov 2017 22:26:06 GMT
CSeq: 102 ACK
Content-Length: 0

<------------->
— (8 headers 0 lines) —
Really destroying SIP dialog ‘00229005-b18d0007-7b2fa58a-dfc26e56@10.9.9.4’ Method: ACK
Reliably Transmitting (no NAT) to 209.x.x.x:5060:
OPTIONS sip:209.x.x.x SIP/2.0
Via: SIP/2.0/UDP 10.9.9.2:5060;branch=z9hG4bK21b21a52
Max-Forwards: 70
From: “asterisk” sip:214xxxxxxx@10.9.9.2;tag=as6dcb3bd5
To: sip:209.x.x.x
Contact: sip:214xxxxxxx@10.9.9.2:5060
Call-ID: 0dae0f1a0d57867b3a6e87ff62a2772b@10.9.9.2:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.32.3
Date: Wed, 08 Nov 2017 22:26:19 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<— SIP read from UDP:209.x.x.x:5060 —>
SIP/2.0 484 Address Incomplete
Via: SIP/2.0/UDP 10.9.9.2:5060;branch=z9hG4bK21b21a52;rport=5060;received=47.190.36.231
From: “asterisk” sip:214xxxxxxx@10.9.9.2;tag=as6dcb3bd5
To: sip:209.x.x.x;tag=b96d0dd7209d7834958cacf8eb0d0ba5.e443
Call-ID: 0dae0f1a0d57867b3a6e87ff62a2772b@10.9.9.2:5060
CSeq: 102 OPTIONS
Server: kamailio (3.3.1 (x86_64/linux))
Content-Length: 0

<------------->
— (8 headers 0 lines) —
Really destroying SIP dialog ‘0dae0f1a0d57867b3a6e87ff62a2772b@10.9.9.2:5060’ Method: OPTIONS
Reliably Transmitting (no NAT) to 10.9.9.4:5060:
OPTIONS sip:301@10.9.9.4:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP 10.9.9.2:5060;branch=z9hG4bK511c4797
Max-Forwards: 70
From: “asterisk” sip:asterisk@10.9.9.2;tag=as1459a45a
To: sip:301@10.9.9.4:5060;transport=udp
Contact: sip:asterisk@10.9.9.2:5060
Call-ID: 7279059a28e12ef31ebe055801b4e36d@10.9.9.2:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.32.3
Date: Wed, 08 Nov 2017 22:26:19 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<— SIP read from UDP:10.9.9.4:50103 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.9.9.2:5060;branch=z9hG4bK511c4797
From: “asterisk” sip:asterisk@10.9.9.2;tag=as1459a45a
To: sip:301@10.9.9.4:5060;transport=udp;tag=00229005b18d03902b38f76f-fc8ddb7c
Call-ID: 7279059a28e12ef31ebe055801b4e36d@10.9.9.2:5060
Date: Wed, 08 Nov 2017 22:26:19 GMT
CSeq: 102 OPTIONS
Server: Cisco-CP7961G/8.5.3
Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE
Allow-Events: kpml,dialog,refer
Accept: application/sdp,multipart/mixed,multipart/alternative
Accept-Encoding: identity
Accept-Language: en
Supported: replaces,join,norefersub
Content-Length: 233
Content-Type: application/sdp
Content-Disposition: session;handling=optional

v=0
o=Cisco-SIPUA 28269 0 IN IP4 10.9.9.4
s=SIP Call
t=0 0
m=audio 0 RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<------------->
— (17 headers 11 lines) —
Really destroying SIP dialog ‘7279059a28e12ef31ebe055801b4e36d@10.9.9.2:5060’ Method: OPTIONS

Why are you using such an old version of Asterisk?

I was hoping you would paste in the output from the Asterisk console as well showing the dialplan logic executing, Just the SIP debug doesn’t help here.

I will note you did try to just dial ‘1’ which does not match an extension in your ‘internal’ context.

As for the old version, it’s just what CentOS 6 comes with and I have it firewalled off and all where only the VoIP proxy has access to it.

On the console I have a verbosity of 5 enabled and it just says this soon as I dial 1:

== Using SIP RTP CoS mark 5

Do I just need a better dial plan? I just want it to dial external for 10 or 1+10 digits or ring an extension if 3 digits are pressed.

You are making the call in the internal context, but your extension 1 is in the from_trunk context. As such it requires a 10 digit number or an 11 digit number, given that it starts with 1.

Logs shows clearly the issue, as David also mentioned before there is no extension (1) on internal context

Ok sorry for my n00bness, but what is the easiest way to fix this?

Dial the complete number.

Look at your contexts, you don’t have any rule to handle just “1”.

1 Like

Oh, well that’s part of the problem. It fast busies immediately after I dial 1, so I can’t even complete the number.

It is not clear what you are trying to do. If you want to just dial 1 from the phone, and have it connect to extension 1, you must include (either physically or with include ==>, extension 1 in the internal context.

If you actually want to dial 1XXXXXXXXXX from the phone, you should either make sure that the phone’s dialplan doesn’t consider 1 to be a complete number, or you should configure the phone to support overlap dialing (or replace it with one that does), so that it doesn’t fail the call when told that more digits are required, but simply tries longer and longer numbers.

Note that fast busy is coming from the phone, not from Asterisk.

1 Like