[SOLVED] Stop auto fallthrough of SIP channel after BUSY

Hello everyone,

I have one more question which I couldn’t find and answer for. I need to have the possibility to continue execution of my dialplan after I called external number through SIP trunk and got rejected.

Basically this is the plan:
Someone calls to our support number
PBX transfers it to external number A through SIP trunk
A rejects the call
PBX then calls external number B through the same SIP trunk
and so on…

Incoming and outgoing calls are made trough the same SIP trunk but I don’t think that there is a problem with this.

This is the part from the dial plan:

[2013-09-19 16:33:06] -- Executing [s@dial-to-external:13] Dial("SIP/Mtel-000005c2", "SIP/Mtel/087xxxxxxx,,Ttg") in new stack [2013-09-19 16:33:06] == Using SIP VIDEO TOS bits 136 [2013-09-19 16:33:06] == Using SIP VIDEO CoS mark 6 [2013-09-19 16:33:06] == Using SIP RTP TOS bits 184 [2013-09-19 16:33:06] == Using SIP RTP CoS mark 5 [2013-09-19 16:33:06] -- Called SIP/Mtel/087xxxxxxx [2013-09-19 16:33:06] -- SIP/Mtel-000005c3 is making progress passing it to SIP/Mtel-000005c2 [2013-09-19 16:33:06] -- SIP/Mtel-000005c3 is ringing [2013-09-19 16:33:09] -- SIP/Mtel-000005c3 is ringing [2013-09-19 16:33:18] -- Got SIP response 486 "Busy here" back from xxx.xxx.xxx.xxx:5060 [2013-09-19 16:33:18] -- SIP/Mtel-000005c3 is busy [2013-09-19 16:33:18] == Everyone is busy/congested at this time (1:1/0/0) [2013-09-19 16:33:18] -- Executing [s@dial-to-external:14] NoOp("SIP/Mtel-000005c2", "HANGUPCAUSE=17") in new stack [2013-09-19 16:33:18] -- Executing [s@dial-to-external:15] ExecIf("SIP/Mtel-000005c2", "1?Set(count=0,end=1)") in new stack [2013-09-19 16:33:18] -- Executing [s@dial-to-external:16] Return("SIP/Mtel-000005c2", "") in new stack [2013-09-19 16:33:18] -- Executing [dial_number@to-external:11] Set("SIP/Mtel-000005c2", "i=2") in new stack [2013-09-19 16:33:18] -- Executing [dial_number@to-external:12] EndWhile("SIP/Mtel-000005c2", "") in new stack [2013-09-19 16:33:18] -- Executing [dial_number@to-external:6] While("SIP/Mtel-000005c2", "0") in new stack [2013-09-19 16:33:18] -- Executing [dial_number@to-external:13] ExecIf("SIP/Mtel-000005c2", "0?Goto(s,find_rule)") in new stack [2013-09-19 16:33:18] -- Auto fallthrough, channel 'SIP/Mtel-000005c2' status is 'BUSY'

So after the BUSY signal, dialplan continued to execute but the client got rejected from the call.

If this is a FreePBX dialplan, you are on the wrong board.

If you wrote it yourself, you need to provide the dialplan so that we can see what it does.

Auto fallthrough happens if Asterisk is continuing from priority n, but there is no priority n+1 matching the same extension, i.e. when it runs off the end of the diaplan.

Thanks again David for your attention! I feel that you are the only active responder here [:

The dialplan is not from FreePBX, I wrote it and it’s a little bit long and complicated as it heavily uses database, but here is the part with the dial command:

[code]exten => s,n,Dial(${trunk_to}/${dial_target},${dur},Ttg)
exten => s,n,NoOp(HANGUPCAUSE=${HANGUPCAUSE})
exten => s,n,ExecIf($[$["${HANGUPCAUSE}" = “16”] | $["${HANGUPCAUSE}" = “0”] | $["${HANGUPCAUSE}" = “17”]]?Set(count=0,end=1))
exten => s,n,Return()

exten => h,1,NoOp(HANGUPCAUSE=${HANGUPCAUSE})
exten => h,n,ExecIf($[$["${HANGUPCAUSE}" = “16”] | $["${HANGUPCAUSE}" = “0”] | $["${HANGUPCAUSE}" = “17”]]?Set(count=0,end=1))
exten => h,n,Return()[/code]

From the CLI log which I posted you can see that after Dial() it goes to the next rules but despite that the call is falling.

In the scenario I posted the dialplan logic continues to execute, it even calls external number B but after client is already disconnected, so it only calls for some seconds and stops as there is no one at the other side.

David, you were right!

As soon as I posted the last time, I found that there is ExecIf() rule (in the parent context) which doesn’t do anything if the condition is false. So it goes to the local h extension but rejects the call. I put Return() in the false part and now everything is working.

Thanks again, you pointed me in the right direction!
Guess I should buy you some beers ;D