[asterisk-dev] Need to run an AGI from dialplan only upon call hold

uma udupi umaudupi at yahoo.com
Fri Aug 31 11:28:26 CDT 2012


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. 



________________________________
 From: Steve Edwards <asterisk.org at sedwards.com>
To: uma udupi <umaudupi at yahoo.com>; Asterisk Developers Mailing List <asterisk-dev at lists.digium.com> 
Sent: Thursday, August 30, 2012 10:57 PM
Subject: Re: [asterisk-dev] Need to run an AGI from dialplan only upon call hold
 
Un-top-posting...

> On Thu, 30 Aug 2012, uma udupi wrote:
> 
> 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

> From: Steve Edwards <asterisk.org at sedwards.com>

> man 2 kill ?

On Thu, 30 Aug 2012, uma udupi wrote:

> hmmm I was hoping for a more graceful way to do it from chan_sip.c

What's 'un-graceful' about kill? (It sounds 'harsher' that it is.)

You set a signal handler in your AGI (written in C, PHP, Perl, shell, fortran, ...).

When you execute 'kill(<pid-of-agi>, <signal-to-send>); 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.

Sounds exactly like what you want.

-- Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120831/0ad16658/attachment.htm>


More information about the asterisk-dev mailing list