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>