How to end Stasis app and go back to the dialplan

I have the dialplan.

exten => _500Z,1,NoOp()
same => n,Stasis(originate-example,${EXTEN})
same => n,Noop(THE END)
same => n,Hangup()

So I make a call from 5001 to 5002 in my Stasis app, creating incoming and outgoing channel, and adding to a bridge. But after I hang up from the called or the caller phones, I don’t see the THE END message or the Hangup event logged in Asterisk. After I hang up, I need it to go back to the dialplan, and start the Stasis app again if I call an extension again. What do I need to do to accomplish this? Am I missing something? Or am I supposed to leave the app running while I get more calls?

You will receive events when a channel hangs up and leaves stasis. It’s up to you to decide what to do with that information. You can hang up the other channel in ARI[1] or you can send it back to the dialplan[2].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Channels+REST+API#Asterisk18ChannelsRESTAPI-hangup
[2] https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Channels+REST+API#Asterisk18ChannelsRESTAPI-continueInDialplan

1 Like

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