I’m writing an AGI script that lets a user make sequential outbound calls. But I expect this is also relevant to dialplan use.
I’m using Dial( … , , gH) to let the user hang up the outbound call by pressing * (as well as the normal called party hanging up) returning to the AGI script to do more stuff.
My customer would like to have a “called party has hanged up” message played to the user when the called party hangs up, but not when the user has pressed * to cause the disconnection.
The DIALSTATUS and HANGUPCAUSE variables are the same for both cases. I can’t seem to find a simple way of differentiating between the hang up reasons from the script. I’ve tried looking through the Asterisk source, and can’t see anything obvious and simple that would do this. There’s Asterisk code that verbose traces “> User hit ‘*’ to disconnect call” which shows that the information could be made available but isn’t useful for scripting/dialplan.
I could do something with Manager events to detect if the user has pressed *, but that’s getting way too complicated for this script.
Have I missed something somewhere? Or can this not be practically done in a nice easy way?