[asterisk-dev] AMD

Kevin Harwell kharwell at digium.com
Thu Jan 30 11:21:18 CST 2020

On Wed, Jan 29, 2020 at 3:07 PM info at magnussolution.com <
info at magnussolution.com> wrote:

> Hello
> I’m to try execute AMD on the 183 signalisation, to detect audio on early
> media.
> I’m work in  app_dial.c and it work ok when the audio start on the
> beginner, but when keep ringing I need to continue analyse until receive
> the 200 OK or some error. I already do it
> but, always there a but, when the call is canceled I need to stop the
> whatfor() method.
> while ((res = ast_waitfor(chan, 2 * maxWaitTimeForFrame)) > -1) {
>         //here is where I analise the 183
>         /* this code check the chan status to break the while()*/
>         if (ast_channel_state(chan) != 5) {
>                  ast_verb(1,"status channel answere %d
> \n",ast_channel_state(chan));
>                  ast_frfree(f);
>                 break;
>          }
> }
> there are any method to check if the originate channel CANCEL the call?
Looking through the app_dial code it looks like the peerflags gets set upon
hangup. If you can get access to that (not sure where your code is located)
then you should be able to check the OPT_CALLER_HANGUP value for that.

Another alternative maybe is the hangupcause as it gets set on the channel
too when hung up so you might be able to retrieve that and check it for
some value, but not sure if the causes will give you what you need.

A third way is to check if the channel hung up using the "ast_check_hangup"
or "ast_check_hangup_locked" function (maybe the best option?).

Kevin Harwell
Senior Software Developer
Sangoma Technologies
Check us out at: https://sangoma.com & https://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20200130/3d5dde3c/attachment-0001.html>

More information about the asterisk-dev mailing list