From 9aa887fe2bab84e60e4242fce24cda2145e11152 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 26 Aug 2011 17:49:34 -0400 Subject: [PATCH 1/2] freetdm: SS7 - CIC value stored in freetdm_ss7_cic variable (cherry-picked from releases.3.3) Conflicts: libs/freetdm/mod_freetdm/mod_freetdm.c libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c --- libs/freetdm/mod_freetdm/mod_freetdm.c | 6 ++++- .../ftmod_sangoma_ss7_handle.c | 22 +++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 5117c6dbe8..caee4dcec9 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1703,7 +1703,6 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%s", ftdm_calling_party_category2str(channel_caller_data->cpc)); - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_screen_ind"); if (!ftdm_strlen_zero(var_value)) { switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Screen", "%d", var_value); @@ -1754,6 +1753,11 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-IAM", "%s", var_value); } + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_cic"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CIC", "%s", var_value); + } + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 20e9a1261c..b541e1b551 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -89,12 +89,13 @@ ftdm_status_t handle_olm_msg(uint32_t suInstId, uint32_t spInstId, uint32_t circ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) { - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - char nadi[2]; - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - memset(nadi, '\0', sizeof(nadi)); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + char var[10]; + + memset(var, '\0', sizeof(var)); /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -209,11 +210,14 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* add any special variables for the dialplan */ - sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val); - sngss7_add_var(sngss7_info, "ss7_clg_nadi", nadi); + sprintf(var, "%d", siConEvnt->cgPtyNum.natAddrInd.val); + sngss7_add_var(sngss7_info, "ss7_clg_nadi", var); - sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val); - sngss7_add_var(sngss7_info, "ss7_cld_nadi", nadi); + sprintf(var, "%d", siConEvnt->cdPtyNum.natAddrInd.val); + sngss7_add_var(sngss7_info, "ss7_cld_nadi", var); + + sprintf(var, "%d", sngss7_info->circuit->cic); + sngss7_add_var(sngss7_info, "ss7_cic", var); if (sngss7_info->circuit->transparent_iam) { sngss7_save_iam(ftdmchan, siConEvnt); From d6f3a02b9493989c1331184067c9951b5c4cb569 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 15 Sep 2011 12:08:32 -0400 Subject: [PATCH 2/2] freetdm: fix compile issue with previous commit (undeclared function) --- libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 11ac14891d..b729552092 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -212,7 +212,6 @@ void ft_to_sngss7_cpg (ftdm_channel_t *ftdmchan) sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &cpg, PROGRESS); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "[CIC:%d]Tx CPG\n", sngss7_info->circuit->cic); - ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; }