[Freeswitch-users] set variable on first leg when bridge is answered

Avi Marcus avi at avimarcus.net
Mon Jun 30 15:30:20 MSD 2014


Perhaps try setting based on the UUID, rather than the leg:

http://wiki.freeswitch.org/wiki/Mod_commands#uuid_setvar

<action application="export" data="nolocal:execute_on_answer=uuid_setvar
${uuid} bridged=1"/>



-Avi


On Mon, Jun 30, 2014 at 12:38 PM, Grant Bagdasarian <GB at cm.nl> wrote:

> Hello,
>
>
>
> I’m first doing a originate which hits the below dialplan when answered.
> When it’s answered I’m setting a variable named “bridged” to 0.
>
> When the user presses the “critical_option_digit” the call is bridged to
> another destination.
>
>
>
> I need to know if this bridge was answered or not.
>
>
>
> I tried different ways of execute_on_answer but that didn’t work:
>
> <action application="set" data="execute_on_answer=set bridged=1"/>
>
> <action application="set" data="nolocal:execute_on_answer=set bridged=1"/>
>
> <action application="export" data="execute_on_answer=set bridged=1"/>
>
> <action application="export" data="nolocal:execute_on_answer=set
> bridged=1"/>
>
>
>
> It is important the bridged variable is set to 1 on the first leg and a
> header is appended to the BYE/200 OK(BYE) of the first leg containing this
> new value.
>
>
>
> Any ideas how to fix this?
>
>
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <include>
>
>   <context name="outbound_cc">
>
>     <extension name="start">
>
>       <condition field="destination_number" expression="^(start)$"
> require-nested="false">
>
>         <action application="answer" />
>
>
>
>         <action application="set" data="bridge_early_media=true" />
>
>         <action application="set" data="hangup_after_bridge=false" />
>
>
>
>         <action application="set" data="critical_option_digit=1" />
>
>         <action application="set"
> data="transfer_destination=0031123456789" />
>
>         <action application="set" data="bridged=0" />
>
>
>
>         <!--Ask And Collect Message-->
>
>         <action application="play_and_get_digits" data="1 1 2 5000 #
> welcome.wav invalid.wav dtmfInput \d 2500"/>
>
>
>
>         <action application="transfer" data="act_on_input XML outbound_cc"
> />
>
>       </condition>
>
>     </extension>
>
>
>
>     <extension name="act_on_input">
>
>       <condition field="${dtmfInput}"
> expression="${critical_option_digit}" break="never">
>
>         <!--Bridge-->
>
>         <action application="set" data="execute_on_answer=set bridged=1"/>
>
>         <action application="bridge"
> data="{sip_copy_custom_headers=false}sofia/outbound/${transfer_destination}@$${outbound_load_balancer_sip_ip}:$${outbound_load_balancer_sip_port}"
> />
>
>
>
>         <action application="export"
> data="sip_bye_h_X-CollectedData=&lt;CollectedData&gt;&lt;DTMFInput&gt;${dtmfInput}&lt;/DTMFInput&gt;&lt;BridgeSucceeded&gt;${bridged}&lt;/BridgeSucceeded&gt;&lt;/CollectedData&gt;"/>
>
>         <action application="export"
> data="sip_rh_X-CollectedData=&lt;CollectedData&gt;&lt;DTMFInput&gt;${dtmfInput}&lt;/DTMFInput&gt;&lt;BridgeSucceeded&gt;${bridged}&lt;/BridgeSucceeded&gt;&lt;/CollectedData&gt;"/>
>
>
>
>         <!--Hangup the channel-->
>
>         <anit-action application="export"
> data="sip_bye_h_X-CollectedData=&lt;CollectedData&gt;&lt;DTMFInput&gt;${dtmfInput}&lt;/DTMFInput&gt;&lt;BridgeSucceeded&gt;${bridged}&lt;/BridgeSucceeded&gt;&lt;/CollectedData&gt;"/>
>
>         <anit-action application="export"
> data="sip_rh_X-CollectedData=&lt;CollectedData&gt;&lt;DTMFInput&gt;${dtmfInput}&lt;/DTMFInput&gt;&lt;BridgeSucceeded&gt;${bridged}&lt;/BridgeSucceeded&gt;&lt;/CollectedData&gt;"/>
>
>         <anti-action application="hangup"/>
>
>       </condition>
>
>     </extension>
>
>   </context>
>
> </include>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140630/bad4e6e1/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list