[Freeswitch-users] exec app on originate

Michael Collins msc at freeswitch.org
Sat Mar 12 00:38:00 MSK 2011


On Fri, Mar 11, 2011 at 1:04 AM, Pete Kelly <pkelly at gmail.com> wrote:

>
>
> On 25 February 2011 01:04, Anthony Minessale <anthony.minessale at gmail.com>wrote:
>
>> early media
>> if you want after answer do
>>
>> originate {ignore_early_media=true}sofia/gateway/blabla/9999999999
>> &app(hahaha)
>>
>
> Is there any way to get the app launched even earlier? I need to be able to
> act upon a 4XX/5XX class response to the INVITE within the app.
>

The originate API does not work that way. The &app(foo) won't be executed
unless the originate is successful. If you get a 4xx/5xx then the originate
will fail and &app(foo) won't ever get executed. There is no notion of
"execute_on_fail" since a failed call means there is no channel/session to
send through the dialplan or through an application.

Depending on exactly what you're doing you probably need to be using "bgapi
originate ..." and then checking the BACKGROUND_JOB event to see what
happened. Alternatively you could be listening/watching for CDRs and then
acting upon them. Alternatively using mod_xml_cdr is an easy way to receive
notification of failed calls. The channel variable
"proto_specific_hangup_cause" will have the "SIP:4xx" value, and you can
react to it accordingly.

-MC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110311/a4dfb943/attachment.html 


More information about the FreeSWITCH-users mailing list