Hi, I'm trying save in cdr_csv a gateway variable, but not work for me. This is the conf for sofia:

<gateway name='XXXXX'>
         <variables>
           <variable name="gateway_id"  value="3"/>
         </variables>
 </gateway>

I'm trying to save variable from the dialplan with:

<extension name="national" continue="true">
      <condition field="destination_number" expression="^([98765]\d{8}|[23]\d{3})$" break="on-true">
        <action application="set" data="exec_after_bridge_app=set gateway_id=\${sofia_gateway_data \${sip_gateway_name} var gateway_id}"/>
        <action application="bridge" data="sofia/gateway/${distributor(XXXX ${sofia(profile external gwlist down)})}/${destination_number}"/>
      </condition>
</extension>

In console it seems to work, but not generate channel variable:

2016-01-11 14:45:57.802303 [DEBUG] switch_cpp.cpp:1103 sofia/external/xxxxx@xx.xx.xx.xx destroy/unlink session from object
EXECUTE sofia/external/965662225@78.136.81.1 set(exec_after_bridge_app=set gateway_id=${sofia_gateway_data ${sip_gateway_name} var gateway_id})
2016-01-11 14:45:57.802303 [DEBUG] mod_dptools.c:1498 SET sofia/external/xxxxx@xx.xx.xx.xx [exec_after_bridge_app]=[set gateway=]
EXECUTE sofia/external/965662225@78.136.81.1 bridge(sofia/gateway/XXXX/xxxxxx)
2016-01-11 14:45:57.802303 [DEBUG] switch_channel.c:1237 sofia/external/xxxxx@xx.xx.xx.xx EXPORTING[export_vars] [t38_passthru]=[true] to event
2016-01-11 14:45:57.802303 [DEBUG] switch_ivr_originate.c:2127 Parsing global variables
2016-01-11 14:45:57.802303 [NOTICE] switch_channel.c:1091 New Channel sofia/external/622073738 [56086a63-c6e9-4c11-b1a4-316165d3bc20]
2016-01-11 14:45:57.802303 [DEBUG] mod_sofia.c:4749 sofia/external/xxxxxx setting variable [gateway_id]=[1]


Is this possible?