Hangup extension

On my Asterisk 1.4 dialplan I have a .h extension to execute after a hangup. This works very well when the outside end of the call hangs up. A nice graceful exit in the dialplan, I indicate by playing a sound.

However, if the local phone (SIP) hangs up, warnings are thrown to the console:

WARNING[10975]: app_playback.c:439 playback_exec: ast_streamfile failed on

Is there a way for me to check the status of a call if its connected locally or otherwise? I tested ${HANGUPCAUSE} which always results 16, and ${CHANNEL(state)} always resutls “up”, no matter which party hangs up first. I cant find any other references to variables or functions that pertain to this, can anyone advise?

-Erich Stein

When a call comes from external you could answer that call and connect it with a internal SIP-phone by putting in your dialplan :

The g-option of the Dial()-command makes that other commands are executed in the context in stead of going to the h-context.

On voip-info.org it states :

The called party in this is your internal SIP-phone.
So when the other side is still on line, a further command within the current context could be to play a sound that indicates that your agent has ended the conversation.

Would that give a solution ?

jonaskellens;

Yes this sounds like it would solve the problem ideally. I will try it out. You’ve been helpful thanks!

-Erich Stein

Ok I tested this. It appears to work as described. I have a GOTOIF statement, based on the DIALSTATUS. In the case of an actual connection it returns “ANSWER” (after called party hangs up). After it exhausts the extension (in my case “s”), it then executes the “h” extension.

Thanks for advice!

Any ideas of how to handle this after a queue hangup? I see in the command console:

Is there a handler or function I can call on a non-zero exit?

-Erich Stein