[Freeswitch-users] set variable on first leg when bridge is answered
Grant Bagdasarian
GB at cm.nl
Mon Jun 30 13:38:33 MSD 2014
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=<CollectedData><DTMFInput>${dtmfInput}</DTMFInput><BridgeSucceeded>${bridged}</BridgeSucceeded></CollectedData>"/>
<action application="export" data="sip_rh_X-CollectedData=<CollectedData><DTMFInput>${dtmfInput}</DTMFInput><BridgeSucceeded>${bridged}</BridgeSucceeded></CollectedData>"/>
<!--Hangup the channel-->
<anit-action application="export" data="sip_bye_h_X-CollectedData=<CollectedData><DTMFInput>${dtmfInput}</DTMFInput><BridgeSucceeded>${bridged}</BridgeSucceeded></CollectedData>"/>
<anit-action application="export" data="sip_rh_X-CollectedData=<CollectedData><DTMFInput>${dtmfInput}</DTMFInput><BridgeSucceeded>${bridged}</BridgeSucceeded></CollectedData>"/>
<anti-action application="hangup"/>
</condition>
</extension>
</context>
</include>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140630/e8d049d6/attachment.html
Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users
mailing list