Problem using external number in freepbx ring group

I am attempting to use an external number within a freepbx ring group. The ring groups works fine if I dial it from an internal extension, an outbound call goes into the did4saleout trunk and the external number rings as part of the ring group.

However when I am dialing into my freepbx from the PSTN and use trigger the ring group as part of an IVR, the outbound call does not get through the did4saleout trunk or the did4saleoutfailover trunk. Both of these trunks work fine for outbound normally. It is only in this circumstance that I have an issue.

Here is the asterisk output:
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/didforsaleoutfailover/15182097178
> 0x7fdbe4036d70 – Probation passed - setting RTP source address to 209.216.2.202:64258
– SIP/didforsaleoutfailover-00000072 is making progress passing it to Local/5182097178@from-internal-0000000a;2
– Local/5182097178@from-internal-0000000a;1 is making progress passing it to SIP/didforsalein1-00000070
> 0x7fdbe4036d70 – Probation passed - setting RTP source address to 209.216.2.202:64258
– Got SIP response 500 “Server error occurred (19/SL)” back from 209.216.15.71:5060
– SIP/didforsaleoutfailover-00000072 is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
– Executing [s@macro-dialout-trunk:23] NoOp(“Local/5182097178@from-internal-0000000a;2”, “Dial failed for some reason with DIALSTATUS = CONGESTION and HANGUPCAUSE = 38”) in new stack
– Executing [s@macro-dialout-trunk:24] GotoIf(“Local/5182097178@from-internal-0000000a;2”, “1?continue,1:s-CONGESTION,1”) in new stack
– Goto (macro-dialout-trunk,continue,1)
– Executing [continue@macro-dialout-trunk:1] NoOp(“Local/5182097178@from-internal-0000000a;2”, “TRUNK Dial failed due to CONGESTION HANGUPCAUSE: 38 - failing through to other trunks”) in new stack
– Executing [continue@macro-dialout-trunk:2] Set(“Local/5182097178@from-internal-0000000a;2”, “CALLERID(number)=”) in new stack
– Executing [5182097178@from-internal:8] Macro(“Local/5182097178@from-internal-0000000a;2”, “outisbusy,”) in new stack
– Executing [s@macro-outisbusy:1] Progress(“Local/5182097178@from-internal-0000000a;2”, “”) in new stack
– Executing [s@macro-outisbusy:2] GotoIf(“Local/5182097178@from-internal-0000000a;2”, “0?emergency,1”) in new stack
– Executing [s@macro-outisbusy:3] GotoIf(“Local/5182097178@from-internal-0000000a;2”, “0?intracompany,1”) in new stack
– Executing [s@macro-outisbusy:4] Playback(“Local/5182097178@from-internal-0000000a;2”, “all-circuits-busy-now&pls-try-call-later, noanswer”) in new stack
– <Local/5182097178@from-internal-0000000a;2> Playing ‘all-circuits-busy-now.ulaw’ (language ‘en’)
– Local/5182097178@from-internal-0000000a;1 is making progress passing it to SIP/didforsalein1-00000070
– <Local/5182097178@from-internal-0000000a;2> Playing ‘pls-try-call-later.ulaw’ (language ‘en’)
– Executing [s@macro-outisbusy:5] Congestion(“Local/5182097178@from-internal-0000000a;2”, “20”) in new stack
– Local/5182097178@from-internal-0000000a;1 is circuit-busy
== Spawn extension (macro-outisbusy, s, 5) exited non-zero on ‘Local/5182097178@from-internal-0000000a;2’ in macro ‘outisbusy’
== Spawn extension (from-internal, 5182097178, 8) exited non-zero on ‘Local/5182097178@from-internal-0000000a;2’
– Executing [h@from-internal:1] Hangup(“Local/5182097178@from-internal-0000000a;2”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on ‘Local/5182097178@from-internal-0000000a;2’
== Everyone is busy/congested at this time (5:0/1/4)

Here is the relevant section of the log with sip debug turned on:

  • Executing [s@macro-dialout-trunk:21] GotoIf(“Local/5182097178@from-internal-0000000b;2”, “0?customtrunk”) in new stack
    – Executing [s@macro-dialout-trunk:22] Dial(“Local/5182097178@from-internal-0000000b;2”, “SIP/didforsaleoutfailover/15182097178,300,Tt”) in new stack
    == Using SIP RTP TOS bits 184
    == Using SIP RTP CoS mark 5
    Audio is at 16674
    Adding codec 100008 (g729) to SDP
    Adding non-codec 0x1 (telephone-event) to SDP
    Reliably Transmitting (NAT) to 209.216.15.71:5060:
    INVITE sip:[email protected] SIP/2.0
    Via: SIP/2.0/UDP 208.125.126.218:5060;branch=z9hG4bK1c8a855a;rport
    Max-Forwards: 70
    From: sip:[email protected];tag=as7360cf5e
    To: sip:[email protected]
    Contact: sip:[email protected]:5060
    Call-ID: [email protected]:5060
    CSeq: 102 INVITE
    User-Agent: FPBX-2.11.0(11.7.0)
    Date: Thu, 27 Feb 2014 06:54:43 GMT
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Content-Type: application/sdp
    Content-Length: 264

v=0
o=root 1423782526 1423782526 IN IP4 208.125.126.218
s=Asterisk PBX 11.7.0
c=IN IP4 208.125.126.218
t=0 0
m=audio 16674 RTP/AVP 18 101
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 SIP/didforsaleoutfailover/15182097178

<— SIP read from UDP:209.216.15.71:5060 —>
SIP/2.0 100 Giving a try
Via: SIP/2.0/UDP 208.125.126.218:5060;branch=z9hG4bK1c8a855a;rport=5060
From: sip:[email protected];tag=as7360cf5e
To: sip:[email protected]
Call-ID: [email protected]:5060
CSeq: 102 INVITE
Server: DFSGW
Content-Length: 0

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

<— SIP read from UDP:209.216.2.212:5060 —>
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 208.125.126.218:5060;received=208.125.126.218;branch=z9hG4bK2c9bddcf;rport=5060
From: sip:[email protected];tag=as6e4d5ac0
To: sip:[email protected];tag=as4461c3c7
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: DidForSale-GW
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:[email protected]
Content-Length: 0

<------------->
— (10 headers 0 lines) —
> 0x7fdbe4048760 – Probation passed - setting RTP source address to 209.216.2.203:10360

<— SIP read from UDP:209.216.15.71:5060 —>
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 208.125.126.218:5060;received=208.125.126.218;branch=z9hG4bK1c8a855a;rport=5060
From: sip:[email protected];tag=as7360cf5e
To: sip:[email protected];tag=as79bbbdb0
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: DidForSale-GW
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:[email protected]
Content-Type: application/sdp
Content-Length: 239

v=0
o=root 2845 2845 IN IP4 209.216.2.203
s=session
c=IN IP4 209.216.2.203
t=0 0
m=audio 10360 RTP/AVP 18 101
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
<------------->
— (11 headers 11 lines) —
list_route: hop: sip:[email protected]
Found RTP audio format 18
Found RTP audio format 101
Found audio description format G729 for ID 18
Found audio description format telephone-event for ID 101
Capabilities: us - (g729), peer - audio=(g729)/video=(nothing)/text=(nothing), combined - (g729)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 209.216.2.203:10360
– SIP/didforsaleoutfailover-00000076 is making progress passing it to Local/5182097178@from-internal-0000000b;2
– Local/5182097178@from-internal-0000000b;1 is making progress passing it to SIP/didforsalein1-00000074
> 0x7fdbe4048760 – Probation passed - setting RTP source address to 209.216.2.203:10360

<— SIP read from UDP:209.216.2.212:5060 —>
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 208.125.126.218:5060;received=208.125.126.218;branch=z9hG4bK2c9bddcf;rport=5060
From: sip:[email protected];tag=as6e4d5ac0
To: sip:[email protected];tag=as4461c3c7
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: DidForSale-GW
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:[email protected]
Content-Length: 0

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

<— SIP read from UDP:209.216.2.212:5060 —>
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 208.125.126.218:5060;received=208.125.126.218;branch=z9hG4bK2c9bddcf;rport=5060
From: sip:[email protected];tag=as6e4d5ac0
To: sip:[email protected];tag=as4461c3c7
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: DidForSale-GW
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:[email protected]
Content-Length: 0

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

<— SIP read from UDP:209.216.15.71:5060 —>
SIP/2.0 500 Server error occurred (19/SL)
Via: SIP/2.0/UDP 208.125.126.218:5060;branch=z9hG4bK1c8a855a;rport=5060
From: sip:[email protected];tag=as7360cf5e
To: sip:[email protected];tag=1a46b81cb0debfcefe84394e70706f8c.d2f9
Call-ID: [email protected]:5060
CSeq: 102 INVITE
Server: DFSGW
Content-Length: 0

<------------->
— (8 headers 0 lines) —
– Got SIP response 500 “Server error occurred (19/SL)” back from 209.216.15.71:5060
set_destination: Parsing sip:[email protected] for address/port to send to
set_destination: set destination to 209.216.2.203:5060
Transmitting (NAT) to 209.216.15.71:5060:
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 208.125.126.218:5060;branch=z9hG4bK1c8a855a;rport
Max-Forwards: 70
From: sip:[email protected];tag=as7360cf5e
To: sip:[email protected];tag=1a46b81cb0debfcefe84394e70706f8c.d2f9
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 ACK
User-Agent: FPBX-2.11.0(11.7.0)
Content-Length: 0


<— SIP read from UDP:209.216.15.71:5060 —>
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 208.125.126.218:5060;received=208.125.126.218;branch=z9hG4bK1c8a855a;rport=5060
From: sip:[email protected];tag=as7360cf5e
To: sip:[email protected];tag=as79bbbdb0
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: DidForSale-GW
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:[email protected]
Content-Length: 0

<------------->
— (10 headers 0 lines) —
set_destination: Parsing sip:[email protected] for address/port to send to
set_destination: set destination to 209.216.2.203:5060
Transmitting (NAT) to 209.216.15.71:5060:
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 208.125.126.218:5060;branch=z9hG4bK1c8a855a;rport
Max-Forwards: 70
From: sip:[email protected];tag=as7360cf5e
To: sip:[email protected];tag=1a46b81cb0debfcefe84394e70706f8c.d2f9
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 ACK
User-Agent: FPBX-2.11.0(11.7.0)
Content-Length: 0


-- SIP/didforsaleoutfailover-00000076 is circuit-busy

== Everyone is busy/congested at this time (1:0/1/0)
– Executing [s@macro-dialout-trunk:23] NoOp(“Local/5182097178@from-internal-0000000b;2”, “Dial failed for some reason with DIALSTATUS = CONGESTION and HANGUPCAUSE = 21”) in new stack
– Executing [s@macro-dialout-trunk:24] GotoIf(“Local/5182097178@from-internal-0000000b;2”, “1?continue,1:s-CONGESTION,1”) in new stack
– Goto (macro-dialout-trunk,continue,1)
– Executing [continue@macro-dialout-trunk:1] NoOp(“Local/5182097178@from-internal-0000000b;2”, “TRUNK Dial failed due to CONGESTION HANGUPCAUSE: 21 - failing through to other trunks”) in new stack
– Executing [continue@macro-dialout-trunk:2] Set(“Local/5182097178@from-internal-0000000b;2”, “CALLERID(number)=”) in new stack
– Executing [5182097178@from-internal:8] Macro(“Local/5182097178@from-internal-0000000b;2”, “outisbusy,”) in new stack
– Executing [s@macro-outisbusy:1] Progress(“Local/5182097178@from-internal-0000000b;2”, “”) in new stack
– Executing [s@macro-outisbusy:2] GotoIf(“Local/5182097178@from-internal-0000000b;2”, “0?emergency,1”) in new stack
– Executing [s@macro-outisbusy:3] GotoIf(“Local/5182097178@from-internal-0000000b;2”, “0?intracompany,1”) in new stack
– Executing [s@macro-outisbusy:4] Playback(“Local/5182097178@from-internal-0000000b;2”, “all-circuits-busy-now&pls-try-call-later, noanswer”) in new stack
– <Local/5182097178@from-internal-0000000b;2> Playing ‘all-circuits-busy-now.ulaw’ (language ‘en’)
– Local/5182097178@from-internal-0000000b;1 is making progress passing it to SIP/didforsalein1-00000074

<— SIP read from UDP:209.216.2.211:5060 —>
BYE sip:[email protected]:5060 SIP/2.0
Record-Route: sip:209.216.2.211;lr=on;ftag=gK0e3682b9
Via: SIP/2.0/UDP 209.216.2.211;branch=z9hG4bK2971.81edff27.0
Via: SIP/2.0/UDP 64.156.174.74:5060;branch=z9hG4bK0eB38961b4a868d5849
From: sip:[email protected];tag=gK0e3682b9
To: sip:[email protected];tag=as4a7d35dd
Call-ID: [email protected]
CSeq: 4502 BYE
Max-Forwards: 69
P-hint: rr-enforced
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Sending to 209.216.2.211:5060 (NAT)
Scheduling destruction of SIP dialog ‘[email protected]’ in 32000 ms (Method: BYE)

<— Transmitting (NAT) to 209.216.2.211:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 209.216.2.211;branch=z9hG4bK2971.81edff27.0;received=209.216.2.211;rport=5060
Via: SIP/2.0/UDP 64.156.174.74:5060;branch=z9hG4bK0eB38961b4a868d5849
Record-Route: sip:209.216.2.211;lr=on;ftag=gK0e3682b9
From: sip:[email protected];tag=gK0e3682b9
To: sip:[email protected];tag=as4a7d35dd
Call-ID: [email protected]
CSeq: 4502 BYE
Server: FPBX-2.11.0(11.7.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

<------------>
Really destroying SIP dialog ‘[email protected]:5060’ Method: INVITE
== Spawn extension (macro-outisbusy, s, 4) exited non-zero on ‘Local/5182097178@from-internal-0000000b;2’ in macro ‘outisbusy’
== Spawn extension (from-internal, 5182097178, 8) exited non-zero on ‘Local/5182097178@from-internal-0000000b;2’