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

Steve Edwards asterisk.org at sedwards.com
Fri Aug 31 00:57:14 CDT 2012


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



More information about the asterisk-dev mailing list