Hi Xiao

I not quite sure what are you trying to accomplish.

Where are you setting the "sip_ph_X" header? at dialplan level? script (lua, js, etc)?

Why you dont "atomize" your actions? For example, at dialplan level:

1. First grab what freetdm give you. Use info app
2. Then capture the channel variable into a new variable
3. When you bridge/transfer the call to the sip side, make the channel setting
4. Use again info app to validate
5. Also check, where are you setting the "sip_ph_X" header, perhaps you are setting it in the wrong leg


On 5/27/2013 12:15 PM, xiaofengcanyuexp@163.com wrote:
Dear support

I got a problem to pass through SS7 info in SIP messages. Here is the code change and test call flow:
--------------------
Code change and log:
--------------------
1. At sangoma module:intercept ACM in ftmod_sangoma_ss7_*.c, parse the BCI and add it to the ftdmchan->call_data:
	sngss7_add_var(sngss7_info, "ss7_acm_bci_hex", val);

2. At freetdm  module mod_freetdm.c, get the variable and set it to channel. Of which, the "prefix" is 'sip_ph_X-':
	var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_acm_bci_hex");
	if (!ftdm_strlen_zero(var_value)) 
	{
		snprintf(variable_name, "%sTEST-BCI-HEX", prefix);
		switch_channel_set_variable_printf(channel, variable_name, "%s", var_value);
	}

>From the test call log:

2013-05-27 07:03:47.747361 [INFO] ftmod_sangoma_ss7_handle.c:362 [s1c1][1:1] [CIC:1]Rx ACM
2013-05-27 07:03:47.747361 [DEBUG] ftmod_sangoma_ss7_support.c:2920 [s1c1][1:1] ACM BCI parameter Hex: 0x1636
2013-05-27 09:00:47.127357 [DEBUG] mod_freetdm.c:5513 Get ACM BCI parameter from sangoma
2013-05-27 09:00:47.127357 [DEBUG] mod_freetdm.c:5530 sip_ph_X-TEST-BCI-HEX:1636
---------------------
My purpose:
---------------------
What I want to do is the encapsulate the sip_ph_X-TEST-BCI-HEX in the 183 SIP message. Like handling IAM  in ftdm_channel_from_event(),
once it sets the the variable like below, the  "X-FreeTDM-SpanNumber" will automatically attached in INVITE message.
         switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-SpanNumber", "%d", spanid); 

---------------------
Problems:
---------------------
While, what's strange are:
1. I add one line in dialplan/default.xml to log the variable with:
    <action application="log" data="The BCI hex is: ${sip_ph_X-TRUSTID-BCI-HEX}"/>
    The freeswitch.log show ${sip_ph_X-TRUSTID-BCI-HEX} is empty
2. The 183 message does not attach the  'X-TRUSTID-BCI-HEX'. 

Can someone help to figure out what's wrong with it?

Thanks
-------------------
2013-05-28




_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2242 / Virus Database: 3184/5853 - Release Date: 05/24/13




--
Atentamente,
Dario García
Consultor.

CCCT, Nivel C2, Sector Yarey, Mz,
Ofc. MZ03a.
Caracas-Venezuela.
Teléfono: +58 212 9081842
Cel: +58 412 2221515
dgarcia@anew.com.ve
http://www.anew.com.ve