<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Yes it works for me, however I somehow need to get the pid of my AGI instance (I can not use killall, as I may not want to kill all the instances of my AGI), which is only available in res_agi (upon fork() of the AGI) or the AGI instance itself. <br></span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Steve Edwards &lt;asterisk.org@sedwards.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> uma udupi &lt;umaudupi@yahoo.com&gt;; Asterisk Developers Mailing List &lt;asterisk-dev@lists.digium.com&gt; <br> <b><span style="font-weight:
 bold;">Sent:</span></b> Thursday, August 30, 2012 10:57 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [asterisk-dev] Need to run an AGI from dialplan only upon call hold<br> </font> </div> <br>
Un-top-posting...<br><br>&gt; On Thu, 30 Aug 2012, uma udupi wrote:<br>&gt; <br>&gt; I made some changes in chan_sip.c to call an AGI (based on some configuration) instead of ast_moh_start(), using pbx_exec() upon receiving AST_CONTROL_HOLD indication. My AGI program plays an IVR, and also takes input. Now if the caller UNHOLDs, I would like to send some signal to the AGI and hence it could exit immediately and release the RTP channels. I don't know if this is even possible, could not locate any functions to do this. Please advice<br><br>&gt; From: Steve Edwards &lt;<a ymailto="mailto:asterisk.org@sedwards.com" href="mailto:asterisk.org@sedwards.com">asterisk.org@sedwards.com</a>&gt;<br><br>&gt; man 2 kill ?<br><br>On Thu, 30 Aug 2012, uma udupi wrote:<br><br>&gt; hmmm I was hoping for a more graceful way to do it from chan_sip.c<br><br>What's 'un-graceful' about kill? (It sounds 'harsher' that it is.)<br><br>You set a signal handler in your AGI (written
 in C, PHP, Perl, shell, fortran, ...).<br><br>When you execute 'kill(&lt;pid-of-agi&gt;, &lt;signal-to-send&gt;); in chan_sip.c, whatever your AGI is doing is 'interrupted' and the signal handler in your AGI is executed where you can close channels, disconnect from database servers, log the event in the system error log (via syslog()) and then exit.<br><br>Sounds exactly like what you want.<br><br>-- Thanks in advance,<br>-------------------------------------------------------------------------<br>Steve Edwards&nbsp; &nbsp; &nbsp;  <a ymailto="mailto:sedwards@sedwards.com" href="mailto:sedwards@sedwards.com">sedwards@sedwards.com</a>&nbsp; &nbsp; &nbsp; Voice: +1-760-468-3867 PST<br>Newline&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fax: +1-760-731-3000<br><br><br> </div> </div>  </div></body></html>