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

uma udupi umaudupi at yahoo.com
Thu Aug 30 19:09:30 CDT 2012


Hi Matthew

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

Thanks,
Uma





________________________________
 From: Matthew  Jordan <mjordan at digium.com>
To: Asterisk Developers Mailing List <asterisk-dev at lists.digium.com> 
Sent: Tuesday, August 28, 2012 7:05 A
Subject: Re: [asterisk-dev] Need to run an AGI from dialplan only upon call hold
 


----- Original Message ----- 

> From: "uma udupi" <umaudupi at yahoo.com>
> To: "uma udupi" <umaudupi at yahoo.com>, asterisk-dev at lists.digium.com,
> "Asterisk Developers Mailing List" <asterisk-dev at lists.digium.com>
> Sent: Tuesday, August 28, 2012 7:15:50 AM
> Subject: Re: [asterisk-dev] Need to run an AGI from dialplan only
> upon call hold

> Hello

> I need help on this one. Could anyone suggest what can be done to
> trigger "something" upon HOLD? I hope this is the right mailling
> list for this topic. If not please let me know where can I take
> this.

<snip>

> I'm new to Asterisk. I need to call (from dialplan) a macro or a
> gosub or an AGI upon one of the connected party in a bridged call
> (on sip trunk) puts the call on HOLD. Anyhelp greatly appreciated

There is no functionality that I'm aware of in Asterisk that would allow
this scenario.  It could certainly be written.

> PS: I looked into app_dial.c if I can capture AST_CONTROL_HOLD event,
> and call a macro, however once ast_bridge_call() is called, Dial app
> does not get mid-call events on the call (like
> AST_CONTROL_HOLD/AST_CONTROL_UNHOLD)

Once two channels are bridged, the application that 'helped' those channels
get bridged - be it app_dial or some other mechanism - is no longer responsible
for servicing the frames on those channels.  The various bridging
implementations handle it after that point.  This could be in the channel
technology itself, in ast_generic_bridge, or in one of the bridging
layer implementations (only used by app_confbridge (Asterisk 10 and later) and
app_page (Asterisk 11 and later)).

You could explore having an option that would cause some portion of dialplan
to be executed on a channel when an AST_CONTROL_HOLD frame is received by any
one of the various bridging implementations; however, that would be quite an
extensive feature given the different types of bridging available in Asterisk.

If you don't need to use AGI, or you don't need to execute your logic
immediately in the dialplan, you could try a different approach and use
AMI.  An external application could listen for the Bridge and MusicOnHold
events.  The Bridge event will tell you when two channels are bridged
together.  Any MusicOnHold events after that should indicate that one
of the channels was either put on Hold or taken off Hold.

You would need to have res_musiconhold loaded and configured for this
scenario to work, but would much easier and less intrusive to implement than
altering Asterisk.

--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120830/4bc3ece7/attachment.htm>


More information about the asterisk-dev mailing list