<div dir="ltr"><div dir="ltr">On Wed, Jan 29, 2020 at 3:07 PM <a href="mailto:info@magnussolution.com">info@magnussolution.com</a> <<a href="mailto:info@magnussolution.com">info@magnussolution.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello<br>
<br>
I’m to try execute AMD on the 183 signalisation, to detect audio on early media.<br>
<br>
<br>
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<br>
<br>
but, always there a but, when the call is canceled I need to stop the whatfor() method.<br>
<br>
<br>
while ((res = ast_waitfor(chan, 2 * maxWaitTimeForFrame)) > -1) {<br>
//here is where I analise the 183 <br>
<br>
/* this code check the chan status to break the while()*/<br>
if (ast_channel_state(chan) != 5) { <br>
ast_verb(1,"status channel answere %d \n",ast_channel_state(chan));<br>
ast_frfree(f); <br>
break; <br>
}<br>
<br>
}<br>
<br>
<br>
there are any method to check if the originate channel CANCEL the call?<br>
<br></blockquote><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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?).</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Kevin Harwell<div>Senior Software Developer</div><div>Sangoma Technologies<br><div>Check us out at: <a href="https://sangoma.com/" target="_blank">https://sangoma.com</a> & <a href="https://asterisk.org" target="_blank">https://asterisk.org</a></div></div></div></div></div></div></div></div>