From dd6853cb983ef149ca61318900d7da1453d8ae88 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 26 Apr 2011 11:04:44 -0400 Subject: [PATCH 01/13] freetdm: ss7 - Fix for some SIP RDNIS headers being overwritten --- libs/freetdm/mod_freetdm/mod_freetdm.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8739c4c0bf..e6930ab16f 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1301,22 +1301,27 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ftdm_set_string(caller_data.rdnis.digits, sipvar); } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-TON"); - if (sipvar) { - caller_data.rdnis.type = (uint8_t)atoi(sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan"); if (sipvar) { - caller_data.rdnis.plan = (uint8_t)atoi(sipvar); + ftdm_call_add_var(&caller_data, "ss7_rdnis_plan", sipvar); } - /* Used by ftmod_sangoma_ss7 only */ sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-NADI"); if (sipvar) { ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_nadi", sipvar); } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Screen"); + if (sipvar) { + ftdm_call_add_var(&caller_data, "ss7_rdnis_screen_ind", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Presentation"); + if (sipvar) { + ftdm_call_add_var(&caller_data, "ss7_rdnis_pres_ind", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen"); if (sipvar) { caller_data.screen = (uint8_t)atoi(sipvar); From 6558b9bba9738094c19527c25db2ffad7ad76d18 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 26 Apr 2011 13:21:49 -0400 Subject: [PATCH 02/13] freetdm: fix compile errors from previous commit --- libs/freetdm/mod_freetdm/mod_freetdm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index e6930ab16f..8d73e391a1 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1303,7 +1303,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan"); if (sipvar) { - ftdm_call_add_var(&caller_data, "ss7_rdnis_plan", sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_plan", sipvar); } sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-NADI"); @@ -1313,12 +1313,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Screen"); if (sipvar) { - ftdm_call_add_var(&caller_data, "ss7_rdnis_screen_ind", sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_screen_ind", sipvar); } sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Presentation"); if (sipvar) { - ftdm_call_add_var(&caller_data, "ss7_rdnis_pres_ind", sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_pres_ind", sipvar); } From f235d95537e6c140e8c11c6a233feacc6495694b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Apr 2011 14:52:53 -0400 Subject: [PATCH 03/13] freetdm: SS7 - Support for receiving RDNIS variables --- libs/freetdm/mod_freetdm/mod_freetdm.c | 12 ++++- .../ftmod_sangoma_ss7_handle.c | 12 +---- .../ftmod_sangoma_ss7_main.h | 1 + .../ftmod_sangoma_ss7_support.c | 45 ++++++++++++++++++- 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8d73e391a1..da5f2c86f9 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1591,8 +1591,18 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-Plan", "%d", channel_caller_data->dnis.plan); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS", "%s", channel_caller_data->rdnis.digits); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-TON", "%d", channel_caller_data->rdnis.type); + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-NADI", "%d", channel_caller_data->rdnis.type); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan); + + 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); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_pres_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Presentation", "%d", channel_caller_data->rdnis.plan); + } 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 40a712f8e2..e2af0852e8 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 @@ -185,17 +185,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " "); } - /* fill in rdnis information*/ - if (siConEvnt->redirgNum.eh.pres) { - if (siConEvnt->redirgNum.addrSig.pres) { - /* fill in the rdnis digits */ - copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, - ftdmchan->caller_data.rdnis.digits, - siConEvnt->cgPtyNum.oddEven); - } - } else { - SS7_DEBUG_CHAN(ftdmchan,"No RDNIS party information in IAM!%s\n", " "); - } + copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum); /* fill in the TMR/bearer capability */ if (siConEvnt->txMedReq.eh.pres) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index ea31a89c5b..c698b4d261 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -790,6 +790,7 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); +ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 22b522409f..9be1f8a8fb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -389,13 +389,56 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red return copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven); } +ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum) +{ + char val[20]; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + + if (redirgNum->eh.pres != PRSNT_NODEF || redirgNum->addrSig.pres != PRSNT_NODEF) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Redirecting Number available\n"); + return FTDM_SUCCESS; + } + + copy_tknStr_from_sngss7(redirgNum->addrSig, ftdmchan->caller_data.rdnis.digits, redirgNum->oddEven); + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number:%s\n", ftdmchan->caller_data.rdnis.digits); + + if (redirgNum->natAddr.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirgNum->natAddr.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdnis_nadi", val); + caller_data->rdnis.type = redirgNum->natAddr.val; + } + + if (redirgNum->scrInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirgNum->scrInd.val); + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdnis_screen_ind", val); + } + + if (redirgNum->presRest.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirgNum->presRest.val); + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Presentation Ind:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdnis_pres_ind", val); + } + + if (redirgNum->numPlan.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirgNum->numPlan.val); + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdnis_plan", val); + caller_data->rdnis.plan = redirgNum->numPlan.val; + } + + return FTDM_SUCCESS; +} + ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) { uint8_t i; uint8_t j; /* check if the token string is present */ - if (str.pres == 1) { j = 0; From 2e8b3d75d0ffe196d7ea8989c2411b8e57c34d28 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 26 Apr 2011 15:13:00 -0400 Subject: [PATCH 04/13] chlog: freetdm: SS7 - Fix for Screening Ind and Presentation Ind not being sent out --- libs/freetdm/mod_freetdm/mod_freetdm.c | 12 ++--- .../ftmod_sangoma_ss7_main.h | 8 +-- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 4 +- .../ftmod_sangoma_ss7_support.c | 49 +++++++++++++------ 4 files changed, 45 insertions(+), 28 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index da5f2c86f9..7f69e11f6c 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1324,12 +1324,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen"); if (sipvar) { - caller_data.screen = (uint8_t)atoi(sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_screen_ind", sipvar); } sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Presentation"); if (sipvar) { - caller_data.pres = (uint8_t)atoi(sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_pres_ind", sipvar); } @@ -1348,19 +1348,19 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } if ((var = channel_get_variable(session, var_event, "freetdm_bearer_layer1"))) { - caller_data.bearer_layer1 = (uint8_t)atoi(var); + caller_data.bearer_layer1 = (uint8_t)atoi(var); } if ((var = channel_get_variable(session, var_event, "freetdm_screening_ind"))) { - ftdm_set_screening_ind(var, &caller_data.screen); + ftdm_set_screening_ind(var, &caller_data.screen); } if ((var = channel_get_variable(session, var_event, "freetdm_presentation_ind"))) { - ftdm_set_presentation_ind(var, &caller_data.pres); + ftdm_set_presentation_ind(var, &caller_data.pres); } if ((var = channel_get_variable(session, var_event, "freetdm_outbound_ton"))) { - ftdm_set_ton(var, &caller_data.dnis.type); + ftdm_set_ton(var, &caller_data.dnis.type); } else { caller_data.dnis.type = outbound_profile->destination_number_ton; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index c698b4d261..f8a9cec9ff 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -785,10 +785,10 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); /* in ftmod_sangoma_ss7_support.c */ -uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); -uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); -uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); -uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); +ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum); +ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum); +ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum); +ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum); ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); 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 9fe279d7c5..149e022ff8 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 @@ -180,10 +180,10 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /* if ANSI */ /* copy down the called number information */ - copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); + copy_cdPtyNum_to_sngss7 (ftdmchan, &iam.cdPtyNum); /* copy down the calling number information */ - copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); + copy_cgPtyNum_to_sngss7 (ftdmchan, &iam.cgPtyNum); /* check if the user would like a custom NADI value for the calling Pty Num */ clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 9be1f8a8fb..17cae48681 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -91,15 +91,16 @@ FTDM_ENUM_NAMES(BLK_FLAGS_NAMES, BLK_FLAGS_STRING) FTDM_STR2ENUM(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t, BLK_FLAGS_NAMES, 31) /* FUNCTIONS ******************************************************************/ -uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) +ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) { - return 0; + return FTDM_SUCCESS; } /******************************************************************************/ -uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) +ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) { + const char *val; int k; int j; int flag; @@ -108,24 +109,38 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) uint8_t lower; uint8_t upper; - /**************************************************************************/ + ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; + cgPtyNum->eh.pres = PRSNT_NODEF; - /**************************************************************************/ + cgPtyNum->natAddrInd.pres = PRSNT_NODEF; cgPtyNum->natAddrInd.val = 0x03; - /**************************************************************************/ + + cgPtyNum->scrnInd.pres = PRSNT_NODEF; - cgPtyNum->scrnInd.val = ftdm->screen; - /**************************************************************************/ + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_screen_ind"); + if (!ftdm_strlen_zero(val)) { + cgPtyNum->scrnInd.val = atoi(val); + } else { + cgPtyNum->scrnInd.val = ftdm->screen; + } + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Screening Ind %d\n", cgPtyNum->scrnInd.val); + cgPtyNum->presRest.pres = PRSNT_NODEF; - cgPtyNum->presRest.val = ftdm->pres; - /**************************************************************************/ + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_pres_ind"); + if (!ftdm_strlen_zero(val)) { + cgPtyNum->presRest.val = atoi(val); + } else { + cgPtyNum->presRest.val = ftdm->pres; + } + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Presentation Ind %d\n", cgPtyNum->presRest.val); + cgPtyNum->numPlan.pres = PRSNT_NODEF; cgPtyNum->numPlan.val = 0x01; - /**************************************************************************/ + cgPtyNum->niInd.pres = PRSNT_NODEF; cgPtyNum->niInd.val = 0x00; - /**************************************************************************/ + cgPtyNum->addrSig.pres = PRSNT_NODEF; /* atoi will search through memory starting from the pointer it is given until @@ -207,18 +222,18 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) cgPtyNum->oddEven.pres = PRSNT_NODEF; cgPtyNum->oddEven.val = odd; /**************************************************************************/ - return 0; + return FTDM_SUCCESS; } /******************************************************************************/ -uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) +ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) { - return 0; + return FTDM_SUCCESS; } /******************************************************************************/ -uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) +ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) { int k; int j; @@ -228,6 +243,8 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) uint8_t lower; uint8_t upper; + ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; + /**************************************************************************/ cdPtyNum->eh.pres = PRSNT_NODEF; /**************************************************************************/ From 89e635cd63cea2ed9407e67f05ee60d17cfee469 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 3 May 2011 16:28:29 -0400 Subject: [PATCH 05/13] FreeTDM: SS7 - Fix for one call state not handled --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c | 1 + 1 file changed, 1 insertion(+) 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 e2af0852e8..72a82acf1f 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 @@ -599,6 +599,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); break; /**************************************************************************/ case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_UP: From e497784ade50912588da722c257ba7d8bc4b3b62 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Thu, 5 May 2011 12:04:15 -0400 Subject: [PATCH 06/13] freetdm: ftmod_r2 - take charge_calls parameter into consideration when accepting a call --- libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 64d8b4fc3c..171112e0af 100755 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -360,11 +360,15 @@ static void ft_r2_clean_call(ftdm_r2_call_t *call) static void ft_r2_accept_call(ftdm_channel_t *ftdmchan) { openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - // FIXME: not always accept as no charge, let the user decide that - // also we should check the return code from openr2_chan_accept_call and handle error condition + ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; + + // FIXME: we should check the return code from openr2_chan_accept_call and handle error condition // hanging up the call with protocol error as the reason, this openr2 API will fail only when there something // wrong at the I/O layer or the library itself - openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE); + if (r2data->charge_calls) + openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE); + else + openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE); } static void ft_r2_answer_call(ftdm_channel_t *ftdmchan) @@ -1697,6 +1701,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) r2data->category = r2conf.category; r2data->allow_collect_calls = r2conf.allow_collect_calls; r2data->flags = 0; + r2data->charge_calls = r2conf.charge_calls; spanpvt->r2context = r2data->r2context; /* just the value must be freed by the hash */ From 65a324b8ba10394334adc7584db99c2bfb04c621 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Thu, 5 May 2011 12:22:18 -0400 Subject: [PATCH 07/13] freetdm: ftmod_r2 - consider force_release and overwrite the disconnect cause, on incoming calls, when it's set. --- libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 171112e0af..1c15f992a2 100755 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1702,6 +1702,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) r2data->allow_collect_calls = r2conf.allow_collect_calls; r2data->flags = 0; r2data->charge_calls = r2conf.charge_calls; + r2data->forced_release = r2conf.forced_release; spanpvt->r2context = r2data->r2context; /* just the value must be freed by the hash */ @@ -1859,6 +1860,10 @@ static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) { if (!r2call->disconnect_rcvd) { openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + /* overwrite the hangup cause if this is an incoming call and forced_release is set */ + if (openr2_chan_get_direction(r2chan) == OR2_DIR_BACKWARD && r2data->forced_release) { + disconnect_cause = OR2_CAUSE_FORCED_RELEASE; + } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ openr2_chan_disconnect_call(r2chan, disconnect_cause); From 7e8c44a407e00663788c3732e694f25b8305012c Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 29 Apr 2011 16:23:18 -0400 Subject: [PATCH 08/13] chlog:freetdm: Support for SS7 - SPIROU TXA and ITX messages --- .../ftmod_sangoma_ss7_handle.c | 43 +++++++++++- .../ftmod_sangoma_ss7_main.h | 4 ++ .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 69 +++++++++++++++++-- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 6 +- 4 files changed, 115 insertions(+), 7 deletions(-) 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 72a82acf1f..57f7e4d927 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 @@ -480,6 +480,47 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ case (SUBDIRNUM): SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SUB-DIR\n", sngss7_info->circuit->cic); break; +#ifdef SANGOMA_SPIROU + case (CHARGE_ACK): + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx TXA\n", sngss7_info->circuit->cic); + break; + case (CHARGE_UNIT): + { + uint32_t charging_unit = 0; + uint32_t msg_num = 0; + char val[3]; + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ITX\n", sngss7_info->circuit->cic); + + memset(val, '\0', sizeof(val)); + + if (siCnStEvnt->chargUnitNum.eh.pres == PRSNT_NODEF && + siCnStEvnt->chargUnitNum.chargUnitNum.pres == PRSNT_NODEF) { + + charging_unit = siCnStEvnt->chargUnitNum.chargUnitNum.val; + } + + if (siCnStEvnt->msgNum.eh.pres == PRSNT_NODEF && + siCnStEvnt->msgNum.msgNum.pres == PRSNT_NODEF) { + + msg_num = siCnStEvnt->msgNum.msgNum.val; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Charging Unit:%d Msg Num:%d\n", charging_unit, msg_num); + + sprintf(val, "%d", charging_unit); + sngss7_add_var(sngss7_info, "ss7_itx_charge_unit", val); + + sprintf(val, "%d", msg_num); + sngss7_add_var(sngss7_info, "ss7_itx_msg_num", val); + + if (sngss7_info->circuit->itx_auto_reply) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Auto-reply with TXA msg\n"); + ft_to_sngss7_txa (ftdmchan); + } + } + break; +#endif /**************************************************************************/ default: SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Unknown Msg\n", sngss7_info->circuit->cic); @@ -522,7 +563,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* go to UP */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - + break; /**************************************************************************/ case FTDM_CHANNEL_STATE_DIALING: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index f8a9cec9ff..7c29530c62 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -322,6 +322,7 @@ typedef struct sng_isup_ckt { uint8_t rdnis_nadi; uint32_t min_digits; + uint8_t itx_auto_reply; void *obj; uint16_t t3; uint16_t t12; @@ -728,6 +729,9 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan); + /* in ftmod_sangoma_ss7_in.c */ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); 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 149e022ff8..4b2c9c438d 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 @@ -187,7 +187,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* check if the user would like a custom NADI value for the calling Pty Num */ clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); - if ((clg_nadi != NULL) && (*clg_nadi)) { + if (!ftdm_strlen_zero(clg_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); } else { @@ -196,7 +196,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); - if ((cld_nadi != NULL) && (*cld_nadi)) { + if (!ftdm_strlen_zero(cld_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi); } else { @@ -206,7 +206,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* check if the user would like us to send a clg_sub-address */ clg_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr"); - if ((clg_subAddr != NULL) && (*clg_subAddr)) { + if (!ftdm_strlen_zero(clg_subAddr)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr); /* clean out the subAddrIE */ @@ -302,7 +302,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) return; } -/******************************************************************************/ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); @@ -382,7 +381,6 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) return; } -/******************************************************************************/ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); @@ -892,6 +890,67 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) return; } +/* French SPIROU send Charge Unit */ +/* No one calls this function yet, but it has been implemented to complement TXA messages */ +void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) +{ + const char* var = NULL; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); +#ifndef SANGOMA_SPIROU + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "ITX message not supported!, please update your libsng_ss7\n"); +#else + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiCnStEvnt itx; + + memset (&itx, 0x0, sizeof (itx)); + + itx.msgNum.eh.pres = PRSNT_NODEF; + itx.msgNum.msgNum.pres = PRSNT_NODEF; + var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_msg_num"); + if (!ftdm_strlen_zero(var)) { + itx.msgNum.msgNum.val = atoi(var); + } else { + itx.msgNum.msgNum.val = 0x0; + } + + itx.chargUnitNum.eh.pres = PRSNT_NODEF; + itx.chargUnitNum.chargUnitNum.pres = PRSNT_NODEF; + var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_charge_unit"); + if (!ftdm_strlen_zero(var)) { + itx.chargUnitNum.chargUnitNum.val = atoi(var); + } else { + itx.chargUnitNum.chargUnitNum.val = 0x0; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "ITX Charging Unit:%d Msg Num:%d\n", itx.chargUnitNum.chargUnitNum.val, itx.msgNum.msgNum.val); + sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &itx, CHARGE_UNIT); + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ITX\n", sngss7_info->circuit->cic); +#endif + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} + +/* French SPIROU send Charging Acknowledgement */ +void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan) +{ +#ifndef SANGOMA_SPIROU + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "TXA message not supported!, please update your libsng_ss7\n"); +#else + SiCnStEvnt txa; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + memset (&txa, 0x0, sizeof(txa)); + + sng_cc_con_status(1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &txa, CHARGE_ACK); + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx TXA\n", sngss7_info->circuit->cic); +#endif + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} /******************************************************************************/ /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 815377b476..2df0a88edb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -124,6 +124,7 @@ typedef struct sng_ccSpan uint32_t cld_nadi; uint32_t rdnis_nadi; uint32_t min_digits; + uint32_t itx_auto_reply; uint32_t t3; uint32_t t12; uint32_t t13; @@ -1892,7 +1893,9 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) sng_ccSpan.typeCntrl = sng_cic_cntrl_type_map[ret].tril_type; SS7_DEBUG("Found an ccSpan typeCntrl = %s\n", sng_cic_cntrl_type_map[ret].sng_type); } - /**********************************************************************/ + } else if (!strcasecmp(parm->var, "itx_auto_reply")) { + sng_ccSpan.itx_auto_reply = ftdm_true(parm->val); + SS7_DEBUG("Found itx_auto_reply %d\n", sng_ccSpan.itx_auto_reply); } else if (!strcasecmp(parm->var, "cicbase")) { /**********************************************************************/ sng_ccSpan.cicbase = atoi(parm->val); @@ -2913,6 +2916,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan) g_ftdm_sngss7_data.cfg.isupCkt[x].options = ccSpan->options; g_ftdm_sngss7_data.cfg.isupCkt[x].switchType = ccSpan->switchType; g_ftdm_sngss7_data.cfg.isupCkt[x].min_digits = ccSpan->min_digits; + g_ftdm_sngss7_data.cfg.isupCkt[x].itx_auto_reply = ccSpan->itx_auto_reply; if (ccSpan->t3 == 0) { g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200; From 81198ac6715ed8f8eab4fec207122a56635bb11c Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 13:13:44 -0400 Subject: [PATCH 09/13] Fix compile issue when SANGOMA_SPIROU is not defined --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 4b2c9c438d..10407963e1 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 @@ -894,14 +894,16 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) /* No one calls this function yet, but it has been implemented to complement TXA messages */ void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) { - const char* var = NULL; - SS7_FUNC_TRACE_ENTER (__FUNCTION__); #ifndef SANGOMA_SPIROU + SS7_FUNC_TRACE_ENTER (__FUNCTION__); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "ITX message not supported!, please update your libsng_ss7\n"); #else + const char* var = NULL; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; SiCnStEvnt itx; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + memset (&itx, 0x0, sizeof (itx)); itx.msgNum.eh.pres = PRSNT_NODEF; From c19074bcd2afac73e7354a47c6434d3ad35d38ca Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 15:31:56 -0400 Subject: [PATCH 10/13] freetdm: ss7 - Support for transmission of Generic Number --- .../ftmod_sangoma_ss7_main.c | 3 +++ .../ftmod_sangoma_ss7_main.h | 12 ++++++++- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 27 ++++--------------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 4f8c069b71..59660765a1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -674,6 +674,9 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } else { /*INBOUND...so FS told us it was going to answer...tell the stack */ ft_to_sngss7_anm(ftdmchan); +#if 1 /* DAVIDY */ + ft_to_sngss7_itx(ftdmchan); +#endif } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 7c29530c62..a355ee0ee7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -320,6 +320,15 @@ typedef struct sng_isup_ckt { uint32_t clg_nadi; uint32_t cld_nadi; uint8_t rdnis_nadi; + + /* Generic Number defaults */ + uint8_t gn_nmbqual; /* Number Qualifier */ + uint8_t gn_nadi; /* Nature of Address indicator */ + uint8_t gn_screen_ind; /* Screening Indicator */ + uint8_t gn_pres_ind; /* Presentation Indicator */ + uint8_t gn_npi; /* Numbering Plan Indicator */ + uint8_t gn_num_inc_ind; /* Number Incomplete Indicator */ + /* END - Generic Number defaults */ uint32_t min_digits; uint8_t itx_auto_reply; @@ -795,7 +804,8 @@ ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cd ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum); ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); - +ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); +ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); 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 10407963e1..a746301cd7 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 @@ -74,8 +74,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) SS7_FUNC_TRACE_ENTER (__FUNCTION__); sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - const char *clg_nadi = NULL; - const char *cld_nadi = NULL; const char *clg_subAddr = NULL; const char *cld_subAddr = NULL; char subAddrIE[MAX_SIZEOF_SUBADDR_IE]; @@ -185,25 +183,10 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* copy down the calling number information */ copy_cgPtyNum_to_sngss7 (ftdmchan, &iam.cgPtyNum); - /* check if the user would like a custom NADI value for the calling Pty Num */ - clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); - if (!ftdm_strlen_zero(clg_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); - iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); - } else { - iam.cgPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].clg_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val); - } + /* copy down the generic number information */ + copy_genNmb_to_sngss7(ftdmchan, &iam.genNmb); - cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); - if (!ftdm_strlen_zero(cld_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); - iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi); - } else { - iam.cdPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", iam.cdPtyNum.natAddrInd.val); - } - + /* TODO - move this to copy_clg_subAddr_to_sngss7 function */ /* check if the user would like us to send a clg_sub-address */ clg_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr"); if (!ftdm_strlen_zero(clg_subAddr)) { @@ -912,7 +895,7 @@ void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) if (!ftdm_strlen_zero(var)) { itx.msgNum.msgNum.val = atoi(var); } else { - itx.msgNum.msgNum.val = 0x0; + itx.msgNum.msgNum.val = 0x1; } itx.chargUnitNum.eh.pres = PRSNT_NODEF; @@ -921,7 +904,7 @@ void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) if (!ftdm_strlen_zero(var)) { itx.chargUnitNum.chargUnitNum.val = atoi(var); } else { - itx.chargUnitNum.chargUnitNum.val = 0x0; + itx.chargUnitNum.chargUnitNum.val = 0x1; } ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "ITX Charging Unit:%d Msg Num:%d\n", itx.chargUnitNum.chargUnitNum.val, itx.msgNum.msgNum.val); From b51074f9df9bda7ef6a1f1efa0b1bfeb212627e5 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 15:35:08 -0400 Subject: [PATCH 11/13] Support for TX generic Number --- .../ftmod_sangoma_ss7_support.c | 301 ++++++------------ 1 file changed, 104 insertions(+), 197 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 17cae48681..21071e680a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -97,19 +97,11 @@ ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cg return FTDM_SUCCESS; } -/******************************************************************************/ ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) { const char *val; - int k; - int j; - int flag; - int odd; - char tmp[2]; - uint8_t lower; - uint8_t upper; - ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; cgPtyNum->eh.pres = PRSNT_NODEF; @@ -122,7 +114,7 @@ ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPt if (!ftdm_strlen_zero(val)) { cgPtyNum->scrnInd.val = atoi(val); } else { - cgPtyNum->scrnInd.val = ftdm->screen; + cgPtyNum->scrnInd.val = caller_data->screen; } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Screening Ind %d\n", cgPtyNum->scrnInd.val); @@ -131,7 +123,7 @@ ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPt if (!ftdm_strlen_zero(val)) { cgPtyNum->presRest.val = atoi(val); } else { - cgPtyNum->presRest.val = ftdm->pres; + cgPtyNum->presRest.val = caller_data->pres; } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Presentation Ind %d\n", cgPtyNum->presRest.val); @@ -141,210 +133,125 @@ ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPt cgPtyNum->niInd.pres = PRSNT_NODEF; cgPtyNum->niInd.val = 0x00; - cgPtyNum->addrSig.pres = PRSNT_NODEF; - - /* atoi will search through memory starting from the pointer it is given until - * it finds the \0...since tmp is on the stack it will start going through the - * possibly causing corruption. Hard code a \0 to prevent this - */ - - tmp[1] = '\0'; - k = 0; - j = 0; - flag = 0; - odd = 0; - upper = 0x0; - lower = 0x0; - - while (1) { - /* grab a digit from the ftdm digits */ - tmp[0] = ftdm->cid_num.digits[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - /* move on to the next value */ - k++; - tmp[0] = ftdm->cid_num.digits[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push it into the lower nibble */ - lower = strtol(&tmp[0], (char **)NULL, 16); - /* move to the next digit */ - k++; - /* grab a digit from the ftdm digits */ - tmp[0] = ftdm->cid_num.digits[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - k++; - tmp[0] = ftdm->cid_num.digits[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push the digit into the upper nibble */ - upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; - } else { - /* there is no upper ... fill in 0 */ - upper = 0x0; - /* throw the odd flag */ - odd = 1; - /* throw the end flag */ - flag = 1; - } /* if (tmp != '\0') */ - } else { - /* keep the odd flag down */ - odd = 0; - /* break right away since we don't need to write the digits */ - break; - } - - /* push the digits into the trillium structure */ - cgPtyNum->addrSig.val[j] = upper | lower; - - /* increment the trillium pointer */ - j++; - - /* if the flag is up we're through all the digits */ - if (flag) break; - - /* move to the next digit */ - k++; - } /* while(1) */ - - cgPtyNum->addrSig.len = j; - - /**************************************************************************/ - cgPtyNum->oddEven.pres = PRSNT_NODEF; - cgPtyNum->oddEven.val = odd; - /**************************************************************************/ - return FTDM_SUCCESS; + return copy_tknStr_to_sngss7(caller_data->cid_num.digits, &cgPtyNum->addrSig, &cgPtyNum->oddEven); } -/******************************************************************************/ ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) { - + /* TODO: Implement me */ return FTDM_SUCCESS; } -/******************************************************************************/ + ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) { - int k; - int j; - int flag; - int odd; - char tmp[2]; - uint8_t lower; - uint8_t upper; + const char *cld_nadi = NULL; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; - - /**************************************************************************/ cdPtyNum->eh.pres = PRSNT_NODEF; - /**************************************************************************/ + cdPtyNum->natAddrInd.pres = PRSNT_NODEF; - cdPtyNum->natAddrInd.val = 0x03; - /**************************************************************************/ + cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); + if (!ftdm_strlen_zero(cld_nadi)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); + cdPtyNum->natAddrInd.val = atoi(cld_nadi); + } else { + cdPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", cdPtyNum->natAddrInd.val); + } + cdPtyNum->numPlan.pres = PRSNT_NODEF; cdPtyNum->numPlan.val = 0x01; - /**************************************************************************/ + cdPtyNum->innInd.pres = PRSNT_NODEF; cdPtyNum->innInd.val = 0x01; - /**************************************************************************/ - cdPtyNum->addrSig.pres = PRSNT_NODEF; - - /* atoi will search through memory starting from the pointer it is given until - * it finds the \0...since tmp is on the stack it will start going through the - * possibly causing corruption. Hard code a \0 to prevent this - */ /* dnis */ - tmp[1] = '\0'; - k = 0; - j = 0; - flag = 0; - odd = 0; - upper = 0x0; - lower = 0x0; - - while (1) { - /* grab a digit from the ftdm digits */ - tmp[0] = ftdm->dnis.digits[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - /* move on to the next value */ - k++; - tmp[0] = ftdm->dnis.digits[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push it into the lower nibble */ - lower = strtol(&tmp[0], (char **)NULL, 16); - /* move to the next digit */ - k++; - /* grab a digit from the ftdm digits */ - tmp[0] = ftdm->dnis.digits[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - k++; - tmp[0] = ftdm->dnis.digits[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push the digit into the upper nibble */ - upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; - } else { - /* there is no upper ... fill in ST */ - upper = 0xF0; - /* keep the odd flag down */ - odd = 0; - /* throw the end flag */ - flag = 1; - } /* if (tmp != '\0') */ - } else { - /* throw the odd flag */ - odd = 1; - /* need to add the ST */ - lower = 0xF; - upper = 0x0; - /* throw the flag */ - flag = 1; - } - - /* push the digits into the trillium structure */ - cdPtyNum->addrSig.val[j] = upper | lower; - - /* increment the trillium pointer */ - j++; - - /* if the flag is up we're through all the digits */ - if (flag) break; - - /* move to the next digit */ - k++; - } /* while(1) */ - - cdPtyNum->addrSig.len = j; - - /**************************************************************************/ - cdPtyNum->oddEven.pres = PRSNT_NODEF; - - cdPtyNum->oddEven.val = odd; - - /**************************************************************************/ - return 0; + + return copy_tknStr_to_sngss7(caller_data->dnis.digits, &cdPtyNum->addrSig, &cdPtyNum->oddEven); } +ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) +{ + const char *val = NULL; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_digits"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number qualifier \"%s\"\n", val); + if (copy_tknStr_to_sngss7((char*)val, &genNmb->addrSig, &genNmb->oddEven) != FTDM_SUCCESS) { + return FTDM_FAIL; + } + } else { + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number qualifier \"%s\"\n", val); + return FTDM_SUCCESS; + } + genNmb->eh.pres = PRSNT_NODEF; + genNmb->addrSig.pres = PRSNT_NODEF; + + genNmb->nmbQual.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_numqual"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"number qualifier\" \"%s\"\n", val); + genNmb->nmbQual.val = atoi(val); + } else { + genNmb->nmbQual.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nmbqual; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"number qualifier\" \"%d\"\n", genNmb->nmbQual.val); + } + genNmb->natAddrInd.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_nadi"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"nature of address\" \"%s\"\n", val); + genNmb->natAddrInd.val = atoi(val); + } else { + genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nadi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"nature of address\" \"%d\"\n", genNmb->natAddrInd.val); + } + genNmb->scrnInd.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_screen_ind"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"screening indicator\" \"%s\"\n", val); + genNmb->scrnInd.val = atoi(val); + } else { + genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_screen_ind; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"screening indicator\" \"%d\"\n", genNmb->natAddrInd.val); + } + genNmb->presRest.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_pres_ind"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"presentation indicator\" \"%s\"\n", val); + genNmb->presRest.val = atoi(val); + } else { + genNmb->presRest.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_pres_ind; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"presentation indicator\" \"%d\"\n", genNmb->presRest.val); + } + genNmb->numPlan.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_npi"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"numbering plan\" \"%s\"\n", val); + genNmb->numPlan.val = atoi(val); + } else { + genNmb->numPlan.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_npi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"numbering plan\" \"%d\"\n", genNmb->numPlan.val); + } + genNmb->niInd.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_num_inc_ind"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"number incomplete indicator\" \"%s\"\n", val); + genNmb->niInd.val = atoi(val); + } else { + genNmb->niInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_num_inc_ind; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val); + } + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) +{ + /* TODO: Implement me */ + return FTDM_SUCCESS; +} ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum) { From eb1a0a395f01e0d592e54006b3540d2078bbf7c6 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 16:03:14 -0400 Subject: [PATCH 12/13] freetdm: ss7 - Support for receiving Generic Number IE --- .../ftmod_sangoma_ss7_handle.c | 2 + .../ftmod_sangoma_ss7_support.c | 54 ++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) 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 57f7e4d927..3348292935 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 @@ -187,6 +187,8 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum); + copy_genNmb_from_sngss7(ftdmchan, &siConEvnt->genNmb); + /* fill in the TMR/bearer capability */ if (siConEvnt->txMedReq.eh.pres) { if (siConEvnt->txMedReq.trMedReq.pres) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 21071e680a..5204c1b8fc 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -249,7 +249,59 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) { - /* TODO: Implement me */ + char val[64]; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + memset(val, 0, sizeof(val)); + + if (genNmb->eh.pres != PRSNT_NODEF || genNmb->addrSig.pres != PRSNT_NODEF) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Generic Number available\n"); + return FTDM_SUCCESS; + } + + copy_tknStr_from_sngss7(genNmb->addrSig, val, genNmb->oddEven); + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_digits", val); + + if (genNmb->nmbQual.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->nmbQual.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_numqual", val); + } + + if (genNmb->natAddrInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->natAddrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"nature of address\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_nadi", val); + } + + if (genNmb->scrnInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->scrnInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"screening indicator\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_screen_ind", val); + } + + if (genNmb->presRest.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->presRest.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"presentation indicator\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_pres_ind", val); + } + + if (genNmb->numPlan.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->numPlan.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"numbering plan\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_npi", val); + } + + if (genNmb->niInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->niInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number incomplete indicator\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_num_inc_ind", val); + } + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; } From e9f8fb4942af2519b5387772e8a827350f606f47 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 17:52:41 -0400 Subject: [PATCH 13/13] freetdm - SS7 Support for custom SIP headers for RDNIS and Generic Number --- libs/freetdm/mod_freetdm/mod_freetdm.c | 70 +++++++++++++++++ .../ftmod_sangoma_ss7_support.c | 76 +++++++++++-------- 2 files changed, 115 insertions(+), 31 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7f69e11f6c..f0b09fda56 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1299,6 +1299,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS"); if (sipvar) { ftdm_set_string(caller_data.rdnis.digits, sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_digits", sipvar); } sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan"); @@ -1321,7 +1322,41 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_pres_ind", sipvar); } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_digits", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NumQual"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_numqual", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NADI"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_nadi", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Screen"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_screen_ind", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Presentation"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_pres_ind", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Plan"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_npi", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NumInComp"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_num_inc_ind", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen"); if (sipvar) { ftdm_usrmsg_add_var(&usrmsg, "ss7_screen_ind", sipvar); @@ -1603,6 +1638,41 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session if (!ftdm_strlen_zero(var_value)) { switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Presentation", "%d", channel_caller_data->rdnis.plan); } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN", "%d", var_value); + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_numqual"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumQual", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_nadi"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NADI", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_screen_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Screen", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_pres_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Presentation", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_npi"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Plan", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_num_inc_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumInComp", "%d", var_value); + } + } /* End - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); */ 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_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 5204c1b8fc..8fafa8995c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -154,11 +154,11 @@ ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPt cdPtyNum->natAddrInd.pres = PRSNT_NODEF; cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); if (!ftdm_strlen_zero(cld_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Called NADI value \"%s\"\n", cld_nadi); cdPtyNum->natAddrInd.val = atoi(cld_nadi); } else { cdPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", cdPtyNum->natAddrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied NADI value found for CLD, using \"%d\"\n", cdPtyNum->natAddrInd.val); } cdPtyNum->numPlan.pres = PRSNT_NODEF; @@ -178,12 +178,12 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_digits"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number qualifier \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number qualifier \"%s\"\n", val); if (copy_tknStr_to_sngss7((char*)val, &genNmb->addrSig, &genNmb->oddEven) != FTDM_SUCCESS) { return FTDM_FAIL; } } else { - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number qualifier \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number qualifier \"%s\"\n", val); return FTDM_SUCCESS; } genNmb->eh.pres = PRSNT_NODEF; @@ -192,56 +192,56 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) genNmb->nmbQual.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_numqual"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"number qualifier\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"%s\"\n", val); genNmb->nmbQual.val = atoi(val); } else { genNmb->nmbQual.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nmbqual; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"number qualifier\" \"%d\"\n", genNmb->nmbQual.val); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \n"); } genNmb->natAddrInd.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_nadi"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"nature of address\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"nature of address\" \"%s\"\n", val); genNmb->natAddrInd.val = atoi(val); } else { genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"nature of address\" \"%d\"\n", genNmb->natAddrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"nature of address\" \"%d\"\n", genNmb->natAddrInd.val); } genNmb->scrnInd.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_screen_ind"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"screening indicator\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"screening indicator\" \"%s\"\n", val); genNmb->scrnInd.val = atoi(val); } else { genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_screen_ind; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"screening indicator\" \"%d\"\n", genNmb->natAddrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"screening indicator\" \"%d\"\n", genNmb->natAddrInd.val); } genNmb->presRest.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_pres_ind"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"presentation indicator\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"presentation indicator\" \"%s\"\n", val); genNmb->presRest.val = atoi(val); } else { genNmb->presRest.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_pres_ind; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"presentation indicator\" \"%d\"\n", genNmb->presRest.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"presentation indicator\" \"%d\"\n", genNmb->presRest.val); } genNmb->numPlan.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_npi"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"numbering plan\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"numbering plan\" \"%s\"\n", val); genNmb->numPlan.val = atoi(val); } else { genNmb->numPlan.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_npi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"numbering plan\" \"%d\"\n", genNmb->numPlan.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"numbering plan\" \"%d\"\n", genNmb->numPlan.val); } genNmb->niInd.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_num_inc_ind"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"number incomplete indicator\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"number incomplete indicator\" \"%s\"\n", val); genNmb->niInd.val = atoi(val); } else { genNmb->niInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_num_inc_ind; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val); } SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; @@ -267,7 +267,7 @@ ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb if (genNmb->nmbQual.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", genNmb->nmbQual.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \n", val); sngss7_add_var(sngss7_info, "ss7_gn_numqual", val); } @@ -310,11 +310,22 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red const char* val = NULL; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - uint8_t len = strlen(caller_data->rdnis.digits); - if (!len) { + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_digits"); + if (!ftdm_strlen_zero(val)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Redirection Number\"%s\"\n", val); + if (copy_tknStr_to_sngss7((char*)val, &redirgNum->addrSig, &redirgNum->oddEven) != FTDM_SUCCESS) { + return FTDM_FAIL; + } + } else if (!ftdm_strlen_zero(caller_data->rdnis.digits)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Redirection Number\"%s\"\n", val); + if (copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven) != FTDM_SUCCESS) { + return FTDM_FAIL; + } + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Number\n"); return FTDM_SUCCESS; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number %s\n", caller_data->rdnis.digits); redirgNum->eh.pres = PRSNT_NODEF; @@ -327,7 +338,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red } else { redirgNum->natAddr.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].rdnis_nadi; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number NADI:%d\n", redirgNum->natAddr.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%d\n", redirgNum->natAddr.val); /* Screening indicator */ redirgNum->scrInd.pres = PRSNT_NODEF; @@ -337,7 +348,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red } else { redirgNum->scrInd.val = FTDM_SCREENING_VERIFIED_PASSED; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val); /* Address presentation restricted ind */ redirgNum->presRest.pres = PRSNT_NODEF; @@ -348,7 +359,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red } else { redirgNum->presRest.val = FTDM_PRES_ALLOWED; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val); /* Numbering plan */ redirgNum->numPlan.pres = PRSNT_NODEF; @@ -360,7 +371,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red redirgNum->numPlan.val = caller_data->rdnis.plan; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%d\n", redirgNum->numPlan.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Numbering plan:%d\n", redirgNum->numPlan.val); return copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven); } @@ -379,6 +390,9 @@ ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *r copy_tknStr_from_sngss7(redirgNum->addrSig, ftdmchan->caller_data.rdnis.digits, redirgNum->oddEven); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number:%s\n", ftdmchan->caller_data.rdnis.digits); + snprintf(val, sizeof(val), "%s", ftdmchan->caller_data.rdnis.digits); + sngss7_add_var(sngss7_info, "ss7_rdnis_digits", val); + if (redirgNum->natAddr.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", redirgNum->natAddr.val); @@ -389,19 +403,19 @@ ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *r if (redirgNum->scrInd.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", redirgNum->scrInd.val); - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%s\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Screening Ind:%s\n", val); sngss7_add_var(sngss7_info, "ss7_rdnis_screen_ind", val); } if (redirgNum->presRest.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", redirgNum->presRest.val); - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Presentation Ind:%s\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Presentation Ind:%s\n", val); sngss7_add_var(sngss7_info, "ss7_rdnis_pres_ind", val); } if (redirgNum->numPlan.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", redirgNum->numPlan.val); - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%s\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Numbering plan:%s\n", val); sngss7_add_var(sngss7_info, "ss7_rdnis_plan", val); caller_data->rdnis.plan = redirgNum->numPlan.val; } @@ -583,7 +597,7 @@ int check_for_state_change(ftdm_channel_t *ftdmchan) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { /* the flag is still up...so we have a problem */ - SS7_DEBUG_CHAN(ftdmchan, "FTDM_CHANNEL_STATE_CHANGE flag set for over 500ms, channel state = %s\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "FTDM_CHANNEL_STATE_CHANGE flag set for over 500ms, channel state = %s\n", ftdm_channel_state2str (ftdmchan->state)); return 1; @@ -1625,7 +1639,7 @@ void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_statu ftdm_sigmsg_t sig; ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - SS7_DEBUG_CHAN(ftdmchan, "Signalling link status changed to %s\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n", ftdm_signaling_status2str(status)); memset(&sig, 0, sizeof(sig)); @@ -1679,12 +1693,12 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan) /* check if the interface is paused or resumed */ if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { - SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is PAUSED\n", sngss7_intf->id); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ISUP intf %d is PAUSED\n", sngss7_intf->id); /* throw the pause flag */ sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); } else { - SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is RESUMED\n", sngss7_intf->id); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ISUP intf %d is RESUMED\n", sngss7_intf->id); /* throw the resume flag */ sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);