diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index a0d2279ba3..ecd9189b39 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1438,6 +1438,24 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi if (sipvar) { ftdm_usrmsg_add_var(&usrmsg, "ss7_iam", sipvar); } + + /* redirection information */ + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDINF-Indicator"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdinfo_indicator", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDINF-OrigReason"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdinfo_orig", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDINF-Count"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdinfo_count", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDINF-Reason"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdinfo_reason", sipvar); + } } if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) { @@ -1707,7 +1725,27 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-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); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%s", ftdm_calling_party_category2str(channel_caller_data->cpc)); - + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_indicator"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-Indicator", "%s", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_orig"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-OrigReason", "%s", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_count"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-Count", "%s", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_reason"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-Reason", "%s", var_value); + } + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_clg_nadi"); if (!ftdm_strlen_zero(var_value)) { switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-NADI", "%s", var_value); 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 7c9b3061f0..0497955059 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 @@ -201,6 +201,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ } copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum); + copy_redirgInfo_from_sngss7(ftdmchan, &siConEvnt->redirInfo); copy_genNmb_from_sngss7(ftdmchan, &siConEvnt->genNmb); copy_cgPtyCat_from_sngss7(ftdmchan, &siConEvnt->cgPtyCat); 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 e39c57802f..bb02d7e3ed 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 @@ -841,6 +841,9 @@ 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_redirgInfo_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *redirInfo); +ftdm_status_t copy_redirgInfo_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *redirInfo); + ftdm_status_t copy_locPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *locPtyNum); ftdm_status_t copy_locPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *locPtyNum); ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); 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 4c7bbf084c..fbfab15d1e 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 @@ -91,6 +91,10 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* Redirecting Number */ copy_redirgNum_to_sngss7(ftdmchan, &iam.redirgNum); + /* Redirecting Information */ + copy_redirgInfo_to_sngss7(ftdmchan, &iam.redirInfo); + + /* Access Transport */ copy_accTrnspt_to_sngss7(ftdmchan, &iam.accTrnspt); 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 3203e52e7d..3230292675 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 @@ -198,6 +198,7 @@ ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cd if (cdPtyNum->eh.pres == PRSNT_NODEF && cdPtyNum->natAddrInd.pres == PRSNT_NODEF) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Called Party Number NADI %d\n", cdPtyNum->natAddrInd.val); sprintf(var, "%d", cdPtyNum->natAddrInd.val); sngss7_add_var(sngss7_info, "ss7_cld_nadi", var); } @@ -538,6 +539,90 @@ ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *r return FTDM_SUCCESS; } +ftdm_status_t copy_redirgInfo_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *redirInfo) +{ + char val[20]; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + if (redirInfo->eh.pres != PRSNT_NODEF ) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Redirecting Information available\n"); + return FTDM_SUCCESS; + } + + + if (redirInfo->redirInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirInfo->redirInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirection Information - redirection indicator:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdinfo_indicator", val); + } + + if (redirInfo->origRedirReas.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirInfo->origRedirReas.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirection Information - original redirection reason:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdinfo_orig", val); + } + + if (redirInfo->redirCnt.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirInfo->redirCnt.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirection Information - redirection count:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdinfo_count", val); + } + + if (redirInfo->redirReas.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirInfo->redirReas.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirection Information - redirection reason:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdinfo_reason", val); + } + + return FTDM_SUCCESS; +} + +ftdm_status_t copy_redirgInfo_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *redirInfo) +{ + const char* val = NULL; + int bProceed = 0; + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdinfo_indicator"); + if (!ftdm_strlen_zero(val)) { + redirInfo->redirInd.val = atoi(val); + bProceed = 1; + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Information on Redirection Indicator\n"); + } + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdinfo_orig"); + if (!ftdm_strlen_zero(val)) { + redirInfo->origRedirReas.val = atoi(val); + bProceed = 1; + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Information on Original Reasons\n"); + } + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdinfo_count"); + if (!ftdm_strlen_zero(val)) { + redirInfo->redirCnt.val = atoi(val); + bProceed = 1; + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Information on Redirection Count\n"); + } + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdinfo_reason"); + if (!ftdm_strlen_zero(val)) { + redirInfo->redirReas.val = atoi(val); + bProceed = 1; + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Information on Redirection Reasons\n"); + } + + if( bProceed == 1 ) { + redirInfo->eh.pres = PRSNT_NODEF; + } else { + redirInfo->eh.pres = NOTPRSNT; + } + + return FTDM_SUCCESS; +} + ftdm_status_t copy_cgPtyCat_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;