[Freeswitch-users] How to export variable downstream on execute_on_answer?

Lợi Đặng loi.dangthanh at gmail.com
Thu Aug 10 11:24:40 UTC 2017


Hi guys, I have a simple call scenario:
*Caller -> FS -> Callee*
Callee answer the call with an additional header called X-MyVar in 200 OK.
I'm trying to store that value only for reporting via
CHANNEL_HANGUP_COMPLETE - event socket.

I'm retrieving that custom header by looking at ${sip_rh_X-MyVar} via
*execute_on_answer* on B leg, and it's fine. But I'm unable to export it to
the A leg.
Here's my dialplan:







*<extension name="logvar">    <condition field="destination_number"
expression="^logvar$">        <action application="export"
data="myvar=${sip_rh_X-MyVar}"/>    </condition></extension><action
application="bridge" data="{execute_on_answer=execute_extension logvar XML
external}sofia/external/${destination_number}"/>*

I don't want X-MyVar header to be passed to Caller, so I have to export the
variable.
But when CHANNEL_HANGUP_COMPLETE fires, the variable *variable_myvar*
present only in the outbound B leg. Look like my export did not work.
Note that I have some upstream exports from A leg to B leg in normal XML
dialplan and they're all fine.

Below is my fs_cli log: 192.168.1.100 is my FS.



*Dialplan: sofia/external/400 at 192.168.1.100:5060
<http://400@192.168.1.100:5060> Action
export(myvar=${sip_rh_X-MyVar})2017-08-10 17:27:29.958572 [NOTICE]
switch_core_session.c:2913 Execute export(myvar=${sip_rh_X-MyVar})EXECUTE
sofia/external/400 at 192.168.1.100:5060 <http://400@192.168.1.100:5060>
export(myvar=598c35116ee949.25824485)2017-08-10 17:27:29.958572 [DEBUG]
switch_channel.c:1296 EXPORT (export_vars)
[myvar]=[598c35116ee949.25824485]*

Not sure what I'm missing in this case.
Any help would be appreciated.
rgds,
Loi Dang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170810/15fc0e08/attachment-0001.html>


More information about the FreeSWITCH-users mailing list