Detect hangup in sub routine?


I have some local channels calling extensions with a subroutine. The problem is that I cannot detect hangup in a subroutine and return correctly without having the Popping routine return locations message.I have to set GOSUB_RESULT=CONTINUE so that other phones still ringing after dialing.
Basically it’s a custom follow me app. So it rings all the phones and the callee must press 1 to confirm.
The problem is that if I hangup the phone while the background message is playing the other phone stop ringing becauseAsterisk does not have the time to set GOSUB_RESULT=CONTINUE because the h extension is not detected.Am I missing something?


exten => 2222,1,NoOp()
same => n,Dial(Local/poste@internal&Local/cell@internal,30)
same  => n,Hangup()

exten => poste,1,NoOp()
same => n,Dial(PJSIP/2005,45,U(sub_answer))
same => n,Hangup()

exten => cell,1,NoOp()
same => n,Dial(PJSIP/15858886565@callcentric,25,U(sub_answer))
same => n,Hangup()

exten => s,1,NoOp()

same  => n,Background(/var/lib/asterisk/sounds/en/followme/options)
same => n,WaitExten(3)

exten => 1,1,NoOp
same  => n,NoOp()
same => n,Return()

;Invalid entry extension
same => n,Return()

;Hang up
same => n,Return()

;Response timeout extension
same => n,Return()

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.