Outbound plan using SIP trunks

Hello. Thanks to this community’s help, our inbound SIP trunks are set up properly and working. However I am having an issue with outbound. Here is a debug of an outgoing call:

Blockquote

<------------>
– Executing [918183003030@device-internal:1] GotoIf(“SIP/0004F2313052-000000a8”, “0?connectdev”) in new stack
– Executing [918183003030@device-internal:2] Set(“SIP/0004F2313052-000000a8”, “hotdesk_ext=”) in new stack
– Executing [918183003030@device-internal:3] Goto(“SIP/0004F2313052-000000a8”, “cont”) in new stack
– Goto (device-internal,918183003030,5)
– Executing [918183003030@device-internal:5] GotoIf(“SIP/0004F2313052-000000a8”, “1?nohotdesk”) in new stack
– Goto (device-internal,918183003030,10)
– Executing [918183003030@device-internal:10] Set(“SIP/0004F2313052-000000a8”, “__HUD_fmfm_set=-1”) in new stack
– Executing [918183003030@device-internal:11] Gosub(“SIP/0004F2313052-000000a8”, “SetHUDfmfm,s,1(”“)”) in new stack
– Executing [s@SetHUDfmfm:1] GotoIf(“SIP/0004F2313052-000000a8”, “0?2:3”) in new stack
– Goto (SetHUDfmfm,s,3)
Really destroying SIP dialog ‘860de6aa-12b9ef31-58d64068@10.10.14.39’ Method: REGISTER
– Executing [s@SetHUDfmfm:3] GotoIf(“SIP/0004F2313052-000000a8”, “1?4:7”) in new stack
– Goto (SetHUDfmfm,s,4)
– Executing [s@SetHUDfmfm:4] Set(“SIP/0004F2313052-000000a8”, “HUD_fmfm=”“”) in new stack
– Executing [s@SetHUDfmfm:5] UserEvent(“SIP/0004F2313052-000000a8”, “fmfm,fmfm: “””) in new stack
– Executing [s@SetHUDfmfm:6] Set(“SIP/0004F2313052-000000a8”, “__HUD_fmfm_set=0”) in new stack
– Executing [s@SetHUDfmfm:7] Return(“SIP/0004F2313052-000000a8”, “”) in new stack
– Executing [918183003030@device-internal:12] Goto(“SIP/0004F2313052-000000a8”, “internal,918183003030,1”) in new stack
– Goto (internal,918183003030,1)
– Executing [918183003030@internal:1] Macro(“SIP/0004F2313052-000000a8”, “tollrest,dialplan,_91NXXNXXXXXX”) in new stack
– Executing [s@macro-tollrest:1] AGI(“SIP/0004F2313052-000000a8”, “agi://127.0.0.1:6969/tollrest?type=dialplan&content=_91NXXNXXXXXX&server=”) in new stack
– <SIP/0004F2313052-000000a8>AGI Script agi://127.0.0.1:6969/tollrest?type=dialplan&content=_91NXXNXXXXXX&server= completed, returning 0
– Executing [s@macro-tollrest:2] GotoIf(“SIP/0004F2313052-000000a8”, “1?20:10”) in new stack
– Goto (macro-tollrest,s,20)
– Executing [918183003030@internal:2] Dial(“SIP/0004F2313052-000000a8”, “SIP/918183003030@megapath-sip,60”) in new stack
== Using SIP RTP CoS mark 5
Audio is at 66.66.77.77 port 18254
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x100 (g729) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 67.103.60.107:5060:
INVITE sip:918183003030@ca01-siptrunk.televoippr.net SIP/2.0
Via: SIP/2.0/UDP 66.66.77.77:5060;branch=z9hG4bK6cc8a1c7;rport
Max-Forwards: 70
From: “Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720
To: sip:918183003030@ca01-siptrunk.televoippr.net
Contact: sip:8183080000@66.66.77.77
Call-ID: 32599d58123b7ad44815f8104b2b0ba1@66.66.77.77
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.0.28-samy-r115
Date: Thu, 06 Sep 2018 19:55:57 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 345

v=0
o=root 1111087464 1111087464 IN IP4 66.66.77.77
s=Asterisk PBX 1.6.0.28-samy-r115
c=IN IP4 66.66.77.77
t=0 0
m=audio 18254 RTP/AVP 0 8 3 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv


-- Called 918183003030@megapath-sip

pbxtra13857*CLI>
<— SIP read from UDP://67.103.60.107:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 66.66.77.77:5060;received=66.66.77.77;branch=z9hG4bK6cc8a1c7;rport=5060
From: “Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720
To: sip:918183003030@ca01-siptrunk.televoippr.net
Call-ID: 32599d58123b7ad44815f8104b2b0ba1@66.66.77.77
CSeq: 102 INVITE

<------------->
— (6 headers 0 lines) —
pbxtra13857*CLI>
<— SIP read from UDP://67.103.60.107:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 66.66.77.77:5060;received=66.66.77.77;branch=z9hG4bK6cc8a1c7;rport=5060
From: “Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720
To: sip:918183003030@ca01-siptrunk.televoippr.net;tag=1097008083-1536263757607
Call-ID: 32599d58123b7ad44815f8104b2b0ba1@66.66.77.77
CSeq: 102 INVITE
WWW-Authenticate: DIGEST qop=“auth”,nonce=“BroadWorksXjlqzrxuvTh2hskjBW”,realm=“BroadWorks”,algorithm=MD5
Content-Length: 0

<------------->
— (8 headers 0 lines) —
Transmitting (NAT) to 67.103.60.107:5060:
ACK sip:918183003030@ca01-siptrunk.televoippr.net SIP/2.0
Via: SIP/2.0/UDP 66.66.77.77:5060;branch=z9hG4bK6cc8a1c7;rport
Max-Forwards: 70
From: “Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720
To: sip:918183003030@ca01-siptrunk.televoippr.net;tag=1097008083-1536263757607
Contact: sip:8183080000@66.66.77.77
Call-ID: 32599d58123b7ad44815f8104b2b0ba1@66.66.77.77
CSeq: 102 ACKLI>
User-Agent: Asterisk PBX 1.6.0.28-samy-r115
Content-Length: 0


Audio is at 66.66.77.77 port 18254
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x100 (g729) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 67.103.60.107:5060:
INVITE sip:918183003030@ca01-siptrunk.televoippr.net SIP/2.0
Via: SIP/2.0/UDP 66.66.77.77:5060;branch=z9hG4bK66c782a2;rport
Max-Forwards: 70
From: “Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720
To: sip:918183003030@ca01-siptrunk.televoippr.net
Contact: sip:8183080000@66.66.77.77
Call-ID: 32599d58123b7ad44815f8104b2b0ba1@66.66.77.77
CSeq: 103 INVITE
User-Agent: Asterisk PBX 1.6.0.28-samy-r115
Authorization: Digest username=“8183080000”, realm=“BroadWorks”, algorithm=MD5, uri="sip:918183003030@ca01-siptrunk.televoippr.net", nonce=“BroadWorksXjlqzrxuvTh2hskjBW”, response=“90167eefe5cc67b40e971bc05540dc32”, qop=auth, cnonce=“368c89bf”, nc=00000001
Date: Thu, 06 Sep 2018 19:55:57 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 345

v=0
o=root 1111087464 1111087465 IN IP4 66.66.77.77
s=Asterisk PBX 1.6.0.28-samy-r115
c=IN IP4 66.66.77.77
t=0 0
m=audio 18254 RTP/AVP 0 8 3 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv


pbxtra13857*CLI>
<— SIP read from UDP://67.103.60.107:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 66.66.77.77:5060;received=66.66.77.77;branch=z9hG4bK66c782a2;rport=5060
From: “Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720
To: sip:918183003030@ca01-siptrunk.televoippr.net
Call-ID: 32599d58123b7ad44815f8104b2b0ba1@66.66.77.77
CSeq: 103 INVITE

<------------->
— (6 headers 0 lines) —
pbxtra13857*CLI>
<— SIP read from UDP://67.103.60.107:5060 —>
SIP/2.0 403 Authentication Failure
Via: SIP/2.0/UDP 66.66.77.77:5060;received=66.66.77.77;branch=z9hG4bK66c782a2;rport=5060
From: “Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720
To: sip:918183003030@ca01-siptrunk.televoippr.net;tag=1598821365-1536263757625
Call-ID: 32599d58123b7ad44815f8104b2b0ba1@66.66.77.77
CSeq: 103 INVITE
Content-Length: 0

<------------->
— (7 headers 0 lines) —
Transmitting (NAT) to 67.103.60.107:5060:
ACK sip:918183003030@ca01-siptrunk.televoippr.net SIP/2.0
Via: SIP/2.0/UDP 66.66.77.77:5060;branch=z9hG4bK66c782a2;rport
Max-Forwards: 70
From: “Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720
To: sip:918183003030@ca01-siptrunk.televoippr.net;tag=1598821365-1536263757625
Contact: sip:8183080000@66.66.77.77
Call-ID: 32599d58123b7ad44815f8104b2b0ba1@66.66.77.77
CSeq: 103 ACK
User-Agent: Asterisk PBX 1.6.0.28-samy-r115
Content-Length: 0


[Sep 6 12:55:57] WARNING[17827]: chan_sip.c:17066 handle_response_invite: Received response: “Forbidden” from ‘“Anya Lastname” sip:8183080000@66.66.77.77;tag=as107c2720’
– SIP/megapath-sip-000000a9 is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
– Executing [918183003030@internal:3] Busy(“SIP/0004F2313052-000000a8”, “”) in new stack
pbxtra13857*CLI>
<— Reliably Transmitting (NAT) to 10.10.14.23:5060 —>
SIP/2.0 486 Busy Here
Via: SIP/2.0/UDP 10.10.14.23;branch=z9hG4bKe7d5d8fc9DCECA71;received=10.10.14.23
From: “7024” sip:0004F2313052@s13857.pbxtra.fonality.com;tag=9023D05E-402B6FBB
To: sip:918183003030@s13857.pbxtra.fonality.com;user=phone;tag=as15b955e2
Call-ID: bcbaa93f-9b00dd50-d5547bd5@10.10.14.23
CSeq: 2 INVITE
User-Agent: Asterisk PBX 1.6.0.28-samy-r115
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0
X-Asterisk-HangupCause: Call Rejected
X-Asterisk-HangupCauseCode: 21

<------------>
== Spawn extension (internal, 918183003030, 3) exited non-zero on ‘SIP/0004F2313052-000000a8’
– Executing [h@internal:1] GotoIf(“SIP/0004F2313052-000000a8”, “1?3”) in new stack
– Goto (internal,h,3)
– Executing [h@internal:3] Hangup(“SIP/0004F2313052-000000a8”, “”) in new stack
== Spawn extension (internal, h, 3) exited non-zero on ‘SIP/0004F2313052-000000a8’
pbxtra13857*CLI>
<— SIP read from UDP://10.10.14.23:5060 —>
ACK sip:918183003030@s13857.pbxtra.fonality.com:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.14.23;branch=z9hG4bKe7d5d8fc9DCECA71
From: “7024” sip:0004F2313052@s13857.pbxtra.fonality.com;tag=9023D05E-402B6FBB
To: sip:918183003030@s13857.pbxtra.fonality.com;user=phone;tag=as15b955e2
CSeq: 2 ACK
Call-ID: bcbaa93f-9b00dd50-d5547bd5@10.10.14.23
Contact: sip:0004F2313052@10.10.14.23
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
User-Agent: PolycomSoundPointIP-SPIP_650-UA/3.1.3.0439
Accept-Language: en
Max-Forwards: 70
Content-Length: 0

<------------->

Blockquote

[trunkld]

exten => _91NXXNXXXXXX,1(top),Macro(tollrest,dialplan,_91NXXNXXXXXX); toll restrictions
;exten => _91NXXNXXXXXX,n,GotoIf($[“${CENTREX}” = “1”]?centrex); Standard long distance
;exten => _91NXXNXXXXXX,n(dial),Set(EXTENSION=${CALLERID(number)}); Standard long distance
;exten => _91NXXNXXXXXX,n,AGI(agi://localhost:4574); Standard long distance
;exten => _91NXXNXXXXXX,n,Wait(1); Standard long distance
;exten => _91NXXNXXXXXX,n,NoOp(Caller ID is ${CALLERID(number)}); Standard long distance
;exten => _91NXXNXXXXXX,n,GotoIf($[${LEN(${CALLERID(number)})}>6]?skipagi); Standard long distance
;exten => _91NXXNXXXXXX,n,AGI(agi://localhost:4574); Standard long distance
;exten => _91NXXNXXXXXX,n,Wait(1); Standard long distance
;exten => _91NXXNXXXXXX,n(skipagi),Set(DIALEXTEN=${EXTEN}); Standard long distance
exten => _91NXXXXXXXXX,n,Dial(SIP/${EXTEN}@megapath-sip,60);
;exten => _91NXXNXXXXXX,n,Congestion()
;exten => _91NXXNXXXXXX,n,Hangup()
;exten => _91NXXNXXXXXX,n,Wait(1)
;exten => _91NXXNXXXXXX,n,Playback(connecting)
;exten => _91NXXNXXXXXX,n,Goto(top)
;exten => _91NXXNXXXXXX,n(centrex),GotoIf($[“${CHANNEL:0:3}” != “DAHDI”]?dial)
;exten => _91NXXNXXXXXX,n,Macro(link-xfer,${EXTEN:1})
exten => _91NXXNXXXXXX,n,Busy()

This is from an old Fonality server, hence some extra entries.

Pointer in the right direction would be great. I do see the Forbidden response, but unsure how to proceed… Thank you guys.

You are not authorised to use the service or have provided the wrong user or password.

Got this figured out a minute ago. For inbound sip config in sip.conf I commented out password, so inbound would work. I created a copy of the sip config for the trunk with a different name, used the password, set the dialplan to use that, and it is working.

Thank you!