I must have misunderstood something with (Bridge)
The same dialplan (context) was executed for the new outgoing leg.
I added this condition in the context / extension to stop the B Leg from processing the dial plan.
<condition field="${direction}" expression="^outbound$" break="on-true"></condition>
Strange I was not expecting Bridge to behave this way.
From: Julien Chavanton <jchavanton@gmail.com>
To: freeswitch-users@lists.freeswitch.org
Cc:
Date: Wed, 6 Jun 2012 11:10:03 -0400
Subject: [Freeswitch-users] scope of channel variables, when are they accessible ?I do not understand the scope of channel variables, when are they accessible ?For example, I am looking for the sip username of the caller call leg.In this example ${sip_auth_username} is empty when logging or calling sf_update.pl but it is correct when calling sf_hangup.pl<include><extension name="outdialing"><condition field="destination_number" expression=".*)"><action application="answer"/><action application="log" data="VARIABLES [${sip_auth_username}][${Caller-Username}][${sip_from_user}][${effective_caller_id_name}][${effective_caller_id_number}]"/><action application="perl" data="/var/fs_hook/sf_update.pl ${sip_auth_username} ${sip_to_user}"/><action application="set" data="api_hangup_hook=perl /var/fs_hook/sf_hangup.pl ${sip_auth_username} ${sip_to_user} "/><action application="bridge" data="{absolute_codec_string='PCMA,PCMU,G729',call_leg=B,session_in_hangup_hook=true'}sofia/gateway/XXXX/XXXX$1"/></condition></extension></include>