From 407f47611bd4c2bb172e473fdcf398328000d28c Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 20 Apr 2011 14:44:29 -0400 Subject: [PATCH 1/7] chlog: freetdm: Added q931-trace and q921-trace options --- .../freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 2 ++ .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 43d6ad555e..112e7cf27d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -213,6 +213,8 @@ typedef struct sngisdn_span_data { int8_t facility_timeout; uint8_t num_local_numbers; uint8_t ignore_cause_value; + uint8_t trace_q931; /* TODO: combine with trace_flags */ + uint8_t trace_q921; /* TODO: combine with trace_flags */ uint8_t raw_trace_q931; /* TODO: combine with trace_flags */ uint8_t raw_trace_q921; /* TODO: combine with trace_flags */ uint8_t timer_t3; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index ee0cdbe1ef..49b07fff33 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -369,6 +369,10 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ parse_yesno(var, val, &signal_data->facility_ie_decode); } else if (!strcasecmp(var, "ignore-cause-value")) { parse_yesno(var, val, &signal_data->ignore_cause_value); + } else if (!strcasecmp(var, "q931-trace")) { + parse_yesno(var, val, &signal_data->trace_q931); + } else if (!strcasecmp(var, "q921-trace")) { + parse_yesno(var, val, &signal_data->trace_q921); } else if (!strcasecmp(var, "q931-raw-trace")) { parse_yesno(var, val, &signal_data->raw_trace_q931); } else if (!strcasecmp(var, "q921-raw-trace")) { From e1c4f6c9c3f19dd40bb61e2c22995b9355d21697 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 20 Apr 2011 14:44:47 -0400 Subject: [PATCH 2/7] Missed file in last commit --- .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index d119ff4fd2..75379eef64 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -996,11 +996,15 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) ftdm_clear_flag(span, FTDM_SPAN_STOP_THREAD); ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - if (signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) { + if (signal_data->trace_q921 == SNGISDN_OPT_TRUE || + signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) { + sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); } - if (signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) { + if (signal_data->trace_q931 == SNGISDN_OPT_TRUE || + signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) { + sngisdn_activate_trace(span, SNGISDN_TRACE_Q931); } From dd6853cb983ef149ca61318900d7da1453d8ae88 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 26 Apr 2011 11:04:44 -0400 Subject: [PATCH 3/7] 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 4/7] 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 5/7] 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 6/7] 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 7/7] 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: