# Inbound call works but outbound call doesn't work."all circuits are busy.."

**URL:** <https://community.asterisk.org/t/inbound-call-works-but-outbound-call-doesnt-work-all-circuits-are-busy/69794>\
**Category:** Asterisk SIP\
**Created:** [February 17, 2017, 5:59pm UTC](https://community.asterisk.org/t/inbound-call-works-but-outbound-call-doesnt-work-all-circuits-are-busy/69794 "2017-02-17T17:59:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigfreepbx](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bigfreepbx](https://community.asterisk.org/u/bigfreepbx)\
**Post date:** [February 17, 2017, 5:59pm UTC](https://community.asterisk.org/t/inbound-call-works-but-outbound-call-doesnt-work-all-circuits-are-busy/69794/1 "2017-02-17T17:59:55Z")

</div>

Incoming call to Asterisk works but not outbound calls “all circuits are busy…”

Trunks:  
host=172.29.130.10  
transport=tcp,udp  
port=5060  
insecure=very  
fromdomain=172.29.130.70  
type=friend  
context=from-internal  
promiscredir=yes  
qualify=yes  
canreinvite=yes

Outbound routes Dial Patterns:

prepend prefix match pattern  
+380101001XXX  
+38 0101001XXX  
+38010100 1XXX

- 

```
  380101001XXX

```

LOGS when dialing number 0101001101:  
localhost_CLI\>  
== Using SIP VIDEO TOS bits 136  
== Using SIP VIDEO CoS mark 6  
== Using SIP RTP TOS bits 184  
== Using SIP RTP CoS mark 5  
– Executing [0101001101@from-internal:1] Macro(“SIP/0401002001-0000000a”, “user-callerid,LIMIT,EXTERNAL,”) in new stack  
– Executing [s@macro-user-callerid:1] Set(“SIP/0401002001-0000000a”, “TOUCH\_MONITOR=1487291718.10”) in new stack  
– Executing [s@macro-user-callerid:2] Set(“SIP/0401002001-0000000a”, “AMPUSER=0401002001”) in new stack  
– Executing [s@macro-user-callerid:3] GotoIf(“SIP/0401002001-0000000a”, “0?report”) in new stack  
– Executing [s@macro-user-callerid:4] ExecIf(“SIP/0401002001-0000000a”, “1?Set(REALCALLERIDNUM=0401002001)”) in new stack  
– Executing [s@macro-user-callerid:5] Set(“SIP/0401002001-0000000a”, “AMPUSER=0401002001”) in new stack  
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/0401002001-0000000a”, “0?limit”) in new stack  
– Executing [s@macro-user-callerid:7] Set(“SIP/0401002001-0000000a”, “AMPUSERCIDNAME=test”) in new stack  
– Executing [s@macro-user-callerid:8] GotoIf(“SIP/0401002001-0000000a”, “0?report”) in new stack  
– Executing [s@macro-user-callerid:9] Set(“SIP/0401002001-0000000a”, “AMPUSERCID=0401002001”) in new stack  
– Executing [s@macro-user-callerid:10] Set(“SIP/0401002001-0000000a”, “\_\_DIAL\_OPTIONS=Ttr”) in new stack  
– Executing [s@macro-user-callerid:11] Set(“SIP/0401002001-0000000a”, “CALLERID(all)=“test” \<0401002001\>”) in new stack  
– Executing [s@macro-user-callerid:12] GotoIf(“SIP/0401002001-0000000a”, “0?limit”) in new stack  
– Executing [s@macro-user-callerid:13] ExecIf(“SIP/0401002001-0000000a”, “1?Set(GROUP(concurrency\_limit)=0401002001)”) in new stack  
– Executing [s@macro-user-callerid:14] GosubIf(“SIP/0401002001-0000000a”, “7?sub-ccss,s,1(from-internal,0101001101)”) in new stack  
– Executing [s@sub-ccss:1] ExecIf(“SIP/0401002001-0000000a”, “0?Return()”) in new stack  
– Executing [s@sub-ccss:2] Set(“SIP/0401002001-0000000a”, “CCSS\_SETUP=TRUE”) in new stack  
– Executing [s@sub-ccss:3] GosubIf(“SIP/0401002001-0000000a”, “0?monitor\_config,1(from-internal,0101001101):monitor\_default,1(from-internal,0101001101)”) in new stack  
– Executing [monitor\_default@sub-ccss:1] GotoIf(“SIP/0401002001-0000000a”, “0?is\_exten”) in new stack  
– Executing [monitor\_default@sub-ccss:2] StackPop(“SIP/0401002001-0000000a”, “”) in new stack  
– Executing [monitor\_default@sub-ccss:3] Return(“SIP/0401002001-0000000a”, “FALSE”) in new stack  
– Executing [s@macro-user-callerid:15] GotoIf(“SIP/0401002001-0000000a”, “1?continue”) in new stack  
– Goto (macro-user-callerid,s,28)  
– Executing [s@macro-user-callerid:28] Set(“SIP/0401002001-0000000a”, “CALLERID(number)=0401002001”) in new stack  
– Executing [s@macro-user-callerid:29] Set(“SIP/0401002001-0000000a”, “CALLERID(name)=test”) in new stack  
– Executing [s@macro-user-callerid:30] Set(“SIP/0401002001-0000000a”, “CDR(cnum)=0401002001”) in new stack  
– Executing [s@macro-user-callerid:31] Set(“SIP/0401002001-0000000a”, “CDR(cnam)=test”) in new stack  
– Executing [s@macro-user-callerid:32] Set(“SIP/0401002001-0000000a”, “CHANNEL(language)=en”) in new stack  
– Executing [0101001101@from-internal:2] Set(“SIP/0401002001-0000000a”, “MOHCLASS=default”) in new stack  
– Executing [0101001101@from-internal:3] Set(“SIP/0401002001-0000000a”, “\_NODEST=”) in new stack  
– Executing [0101001101@from-internal:4] Gosub(“SIP/0401002001-0000000a”, “sub-record-check,s,1(out,0101001101,)”) in new stack  
– Executing [s@sub-record-check:1] Set(“SIP/0401002001-0000000a”, “REC\_POLICY\_MODE\_SAVE=”) in new stack  
– Executing [s@sub-record-check:2] GotoIf(“SIP/0401002001-0000000a”, “1?check”) in new stack  
– Goto (sub-record-check,s,7)  
– Executing [s@sub-record-check:7] Set(“SIP/0401002001-0000000a”, “\_\_MON\_FMT=wav”) in new stack  
– Executing [s@sub-record-check:8] GotoIf(“SIP/0401002001-0000000a”, “1?next”) in new stack  
– Goto (sub-record-check,s,11)  
– Executing [s@sub-record-check:11] ExecIf(“SIP/0401002001-0000000a”, “0?Return()”) in new stack  
– Executing [s@sub-record-check:12] ExecIf(“SIP/0401002001-0000000a”, “0?Set(\_\_REC\_POLICY\_MODE=)”) in new stack  
– Executing [s@sub-record-check:13] GotoIf(“SIP/0401002001-0000000a”, “0?out,1”) in new stack  
– Executing [s@sub-record-check:14] Set(“SIP/0401002001-0000000a”, “\_\_REC\_STATUS=INITIALIZED”) in new stack  
– Executing [s@sub-record-check:15] Set(“SIP/0401002001-0000000a”, “NOW=1487291718”) in new stack  
– Executing [s@sub-record-check:16] Set(“SIP/0401002001-0000000a”, “\_\_DAY=16”) in new stack  
– Executing [s@sub-record-check:17] Set(“SIP/0401002001-0000000a”, “\_\_MONTH=02”) in new stack  
– Executing [s@sub-record-check:18] Set(“SIP/0401002001-0000000a”, “\_\_YEAR=2017”) in new stack  
– Executing [s@sub-record-check:19] Set(“SIP/0401002001-0000000a”, “\_\_TIMESTR=20170216-163518”) in new stack  
– Executing [s@sub-record-check:20] Set(“SIP/0401002001-0000000a”, “\_\_FROMEXTEN=0401002001”) in new stack  
– Executing [s@sub-record-check:21] Set(“SIP/0401002001-0000000a”, “\_\_CALLFILENAME=out-0101001101-0401002001-20170216-163518-1487291718.10”) in new stack  
– Executing [s@sub-record-check:22] Goto(“SIP/0401002001-0000000a”, “out,1”) in new stack  
– Goto (sub-record-check,out,1)  
– Executing [out@sub-record-check:1] ExecIf(“SIP/0401002001-0000000a”, “1?Set(\_\_REC\_POLICY\_MODE=dontcare)”) in new stack  
– Executing [out@sub-record-check:2] GosubIf(“SIP/0401002001-0000000a”, “0?record,1(exten,0101001101,0401002001)”) in new stack  
– Executing [out@sub-record-check:3] Return(“SIP/0401002001-0000000a”, “”) in new stack  
– Executing [0101001101@from-internal:5] Macro(“SIP/0401002001-0000000a”, “dialout-trunk,2,+380101001101,off”) in new stack  
– Executing [s@macro-dialout-trunk:1] Set(“SIP/0401002001-0000000a”, “DIAL\_TRUNK=2”) in new stack  
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/0401002001-0000000a”, “0?sub-pincheck,s,1()”) in new stack  
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/0401002001-0000000a”, “0?disabletrunk,1”) in new stack  
– Executing [s@macro-dialout-trunk:4] Set(“SIP/0401002001-0000000a”, “DIAL\_NUMBER=+380101001101”) in new stack  
– Executing [s@macro-dialout-trunk:5] Set(“SIP/0401002001-0000000a”, “DIAL\_TRUNK\_OPTIONS=Ttr”) in new stack  
– Executing [s@macro-dialout-trunk:6] Set(“SIP/0401002001-0000000a”, “OUTBOUND\_GROUP=OUT\_2”) in new stack  
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/0401002001-0000000a”, “1?nomax”) in new stack  
– Goto (macro-dialout-trunk,s,9)  
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/0401002001-0000000a”, “0?skipoutcid”) in new stack  
– Executing [s@macro-dialout-trunk:10] Set(“SIP/0401002001-0000000a”, “DIAL\_TRUNK\_OPTIONS=Tt”) in new stack  
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/0401002001-0000000a”, “outbound-callerid,2”) in new stack  
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/0401002001-0000000a”, “0?Set(CALLERPRES()=)”) in new stack  
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/0401002001-0000000a”, “0?Set(REALCALLERIDNUM=0401002001)”) in new stack  
– Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/0401002001-0000000a”, “1?normcid”) in new stack  
– Goto (macro-outbound-callerid,s,6)  
– Executing [s@macro-outbound-callerid:6] Set(“SIP/0401002001-0000000a”, “USEROUTCID=”) in new stack  
– Executing [s@macro-outbound-callerid:7] Set(“SIP/0401002001-0000000a”, “EMERGENCYCID=”) in new stack  
– Executing [s@macro-outbound-callerid:8] Set(“SIP/0401002001-0000000a”, “TRUNKOUTCID=”) in new stack  
– Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/0401002001-0000000a”, “1?trunkcid”) in new stack  
– Goto (macro-outbound-callerid,s,14)  
– Executing [s@macro-outbound-callerid:14] ExecIf(“SIP/0401002001-0000000a”, “0?Set(CALLERID(all)=)”) in new stack  
– Executing [s@macro-outbound-callerid:15] ExecIf(“SIP/0401002001-0000000a”, “0?Set(CALLERID(all)=)”) in new stack  
– Executing [s@macro-outbound-callerid:16] ExecIf(“SIP/0401002001-0000000a”, “0?Set(CALLERID(all)=)”) in new stack  
– Executing [s@macro-outbound-callerid:17] ExecIf(“SIP/0401002001-0000000a”, “0?Set(CALLERPRES()=prohib\_passed\_screen)”) in new stack  
– Executing [s@macro-outbound-callerid:18] Set(“SIP/0401002001-0000000a”, “CDR(outbound\_cnum)=0401002001”) in new stack  
– Executing [s@macro-outbound-callerid:19] Set(“SIP/0401002001-0000000a”, “CDR(outbound\_cnam)=test”) in new stack  
– Executing [s@macro-dialout-trunk:12] GosubIf(“SIP/0401002001-0000000a”, “0?sub-flp-2,s,1()”) in new stack  
– Executing [s@macro-dialout-trunk:13] Set(“SIP/0401002001-0000000a”, “OUTNUM=+380101001101”) in new stack  
– Executing [s@macro-dialout-trunk:14] Set(“SIP/0401002001-0000000a”, “custom=SIP/Lync Trunk”) in new stack  
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/0401002001-0000000a”, “0?Set(DIAL\_TRUNK\_OPTIONS=M(setmusic^default)Tt)”) in new stack  
– Executing [s@macro-dialout-trunk:16] ExecIf(“SIP/0401002001-0000000a”, “0?Set(DIAL\_TRUNK\_OPTIONS=TtM(confirm))”) in new stack  
– Executing [s@macro-dialout-trunk:17] Macro(“SIP/0401002001-0000000a”, “dialout-trunk-predial-hook,”) in new stack  
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“SIP/0401002001-0000000a”, “”) in new stack  
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/0401002001-0000000a”, “0?bypass,1”) in new stack  
– Executing [s@macro-dialout-trunk:19] ExecIf(“SIP/0401002001-0000000a”, “1?Set(CONNECTEDLINE(num,i)=+380101001101)”) in new stack  
– Executing [s@macro-dialout-trunk:20] ExecIf(“SIP/0401002001-0000000a”, “1?Set(CONNECTEDLINE(name,i)=CID:0401002001)”) in new stack  
– Executing [s@macro-dialout-trunk:21] GotoIf(“SIP/0401002001-0000000a”, “0?customtrunk”) in new stack  
– Executing [s@macro-dialout-trunk:22] Dial(“SIP/0401002001-0000000a”, “SIP/Lync Trunk/+380101001101,300,Tt”) in new stack  
== Using SIP VIDEO TOS bits 136  
== Using SIP VIDEO CoS mark 6  
== Using SIP RTP TOS bits 184  
== Using SIP RTP CoS mark 5  
– Called SIP/Lync Trunk/+380101001101  
– SIP/Lync Trunk-0000000b is ringing  
– SIP/Lync Trunk-0000000b redirecting info has changed, passing it to SIP/0401002001-0000000a  
– Got SIP response 480 “Temporarily Unavailable” back from 172.29.130.10:5060  
– SIP/Lync Trunk-0000000b is circuit-busy  
== Everyone is busy/congested at this time (1:0/1/0)  
– Executing [s@macro-dialout-trunk:23] NoOp(“SIP/0401002001-0000000a”, “Dial failed for some reason with DIALSTATUS = CONGESTION and HANGUPCAUSE = 19”) in new stack  
– Executing [s@macro-dialout-trunk:24] GotoIf(“SIP/0401002001-0000000a”, “0?continue,1:s-CONGESTION,1”) in new stack  
– Goto (macro-dialout-trunk,s-CONGESTION,1)  
– Executing [s-CONGESTION@macro-dialout-trunk:1] Set(“SIP/0401002001-0000000a”, “RC=19”) in new stack  
– Executing [s-CONGESTION@macro-dialout-trunk:2] Goto(“SIP/0401002001-0000000a”, “19,1”) in new stack  
– Goto (macro-dialout-trunk,19,1)  
– Executing [19@macro-dialout-trunk:1] Goto(“SIP/0401002001-0000000a”, “continue,1”) in new stack  
– Goto (macro-dialout-trunk,continue,1)  
– Executing [continue@macro-dialout-trunk:1] NoOp(“SIP/0401002001-0000000a”, “TRUNK Dial failed due to CONGESTION HANGUPCAUSE: 19 - failing through to other trunks”) in new stack  
– Executing [continue@macro-dialout-trunk:2] Set(“SIP/0401002001-0000000a”, “CALLERID(number)=0401002001”) in new stack  
– Executing [0101001101@from-internal:6] Macro(“SIP/0401002001-0000000a”, “outisbusy,”) in new stack  
– Executing [s@macro-outisbusy:1] Progress(“SIP/0401002001-0000000a”, “”) in new stack  
– Executing [s@macro-outisbusy:2] GotoIf(“SIP/0401002001-0000000a”, “0?emergency,1”) in new stack  
– Executing [s@macro-outisbusy:3] GotoIf(“SIP/0401002001-0000000a”, “0?intracompany,1”) in new stack  
– Executing [s@macro-outisbusy:4] Playback(“SIP/0401002001-0000000a”, “all-circuits-busy-now&pls-try-call-later, noanswer”) in new stack  
– \<SIP/0401002001-0000000a\> Playing ‘all-circuits-busy-now.ulaw’ (language ‘en’)  
\> 0x7f1b14027d70 – Probation passed - setting RTP source address to 172.29.137.25:56368  
[2017-02-16 16:35:20] NOTICE[3421][C-00000005]: res\_rtp\_asterisk.c:3944 ast\_rtp\_read: Unknown RTP codec 126 received from ‘172.29.137.25:56368’  
– \<SIP/0401002001-0000000a\> Playing ‘pls-try-call-later.ulaw’ (language ‘en’)  
– Executing [s@macro-outisbusy:5] Congestion(“SIP/0401002001-0000000a”, “20”) in new stack  
[2017-02-16 16:35:24] WARNING[3421][C-00000005]: channel.c:4860 ast\_prod: Prodding channel ‘SIP/0401002001-0000000a’ failed  
== Spawn extension (macro-outisbusy, s, 5) exited non-zero on ‘SIP/0401002001-0000000a’ in macro ‘outisbusy’  
== Spawn extension (from-internal, 0101001101, 6) exited non-zero on ‘SIP/0401002001-0000000a’  
– Executing [h@from-internal:1] Hangup(“SIP/0401002001-0000000a”, “”) in new stack  
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/0401002001-0000000a’  
localhost_CLI\>

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [February 17, 2017, 6:06pm UTC](https://community.asterisk.org/t/inbound-call-works-but-outbound-call-doesnt-work-all-circuits-are-busy/69794/2 "2017-02-17T18:06:05Z")

</div>

> [@bigfreepbx](#):
>
> – Got SIP response 480 “Temporarily Unavailable” back from 172.29.130.10:5060

> [@bigfreepbx](#):
>
> with DIALSTATUS = CONGESTION and HANGUPCAUSE = 19") in new stack

Code No. 19 - no answer from user (user alerted).  
This cause is used when the called party has been alerted but does not respond with a connect indication within a prescribed period of time. Note

---

<div class="post-metadata">

**Author:** ![bigfreepbx](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bigfreepbx](https://community.asterisk.org/u/bigfreepbx)\
**Post date:** [February 17, 2017, 6:18pm UTC](https://community.asterisk.org/t/inbound-call-works-but-outbound-call-doesnt-work-all-circuits-are-busy/69794/3 "2017-02-17T18:18:50Z")

</div>

Thanks for your response. Does it mean that it reaches the destination but the user is not responding or offline?

---

<div class="post-metadata">

**Author:** ![ambiorixg12](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/ambiorixg12/32/1887_2.png) [@ambiorixg12](https://community.asterisk.org/u/ambiorixg12)\
**Post date:** [February 17, 2017, 6:25pm UTC](https://community.asterisk.org/t/inbound-call-works-but-outbound-call-doesnt-work-all-circuits-are-busy/69794/4 "2017-02-17T18:25:44Z")

</div>

Based on the SIP 480 reponse, this is the current situation

480 Temporarily Unavailable

The callee’s end system was contacted successfully but the callee is  
currently unavailable (for example, is not logged in, logged in but  
in a state that precludes communication with the callee, or has  
activated the “do not disturb” feature). The response MAY indicate a  
better time to call in the Retry-After header field. The user could  
also be available elsewhere (unbeknownst to this server). The reason  
phrase SHOULD indicate a more precise cause as to why the callee is  
unavailable. This value SHOULD be settable by the UA. Status 486  
(Busy Here) MAY be used to more precisely indicate a particular  
reason for the call failure.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [February 17, 2017, 6:33pm UTC](https://community.asterisk.org/t/inbound-call-works-but-outbound-call-doesnt-work-all-circuits-are-busy/69794/5 "2017-02-17T18:33:48Z")

</div>

Cutting out all the FreePBX noise:

> [@bigfreepbx](#):
>
> – Executing [s@macro-dialout-trunk:22] Dial(“SIP/0401002001-0000000a”, “SIP/Lync Trunk/+380101001101,300,Tt”) in new stack  
> == Using SIP VIDEO TOS bits 136  
> == Using SIP VIDEO CoS mark 6  
> == Using SIP RTP TOS bits 184  
> == Using SIP RTP CoS mark 5  
> – Called SIP/Lync Trunk/+380101001101  
> – SIP/Lync Trunk-0000000b is ringing  
> – SIP/Lync Trunk-0000000b redirecting info has changed, passing it to SIP/0401002001-0000000a  
> – Got SIP response 480 “Temporarily Unavailable” back from 172.29.130.10:5060  
> – SIP/Lync Trunk-0000000b is circuit-busy  
> == Everyone is busy/congested at this time (1:0/1/0)

It reached Skype for Business  
Skype for Business tried to forward it to the destination.  
The destination redirected the call, and the redirection was handled within Skype for Business  
The new destination rejected the call.

There is no evidence of anything wrong in Asterisk. This isn’t even an appropriate rejection for a bad dialled number.

---

<div class="post-metadata">

**Author:** ![bigfreepbx](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bigfreepbx](https://community.asterisk.org/u/bigfreepbx)\
**Post date:** [February 17, 2017, 10:40pm UTC](https://community.asterisk.org/t/inbound-call-works-but-outbound-call-doesnt-work-all-circuits-are-busy/69794/6 "2017-02-17T22:40:12Z")

</div>

Thank you for the response guys!
