diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 003be91b17..e694a0f8fa 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -115,6 +115,8 @@ struct private_object { ftdm_channel_t *ftdmchan; uint32_t write_error; uint32_t read_error; + char network_peer_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1]; + }; /* private data attached to FTDM channels (only FXS for now) */ @@ -1246,6 +1248,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi int argc = 0; const char *var; const char *dest_num = NULL, *callerid_num = NULL; + const char *network_peer_uuid = NULL; ftdm_hunting_scheme_t hunting; ftdm_usrmsg_t usrmsg; @@ -1336,6 +1339,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi if (session && globals.sip_headers) { switch_channel_t *channel = switch_core_session_get_channel(session); const char *sipvar; + + network_peer_uuid = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-TransUUID"); + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-CallerName"); if (sipvar) { ftdm_set_string(caller_data.cid_name, sipvar); @@ -1592,6 +1598,20 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi goto fail; } + if (network_peer_uuid) { + switch_core_session_t *network_peer = switch_core_session_locate(network_peer_uuid); + if (network_peer) { + const char *my_uuid = switch_core_session_get_uuid(*new_session); + private_t *peer_private = switch_core_session_get_private(network_peer); + switch_set_string(tech_pvt->network_peer_uuid, network_peer_uuid); + switch_set_string(peer_private->network_peer_uuid, my_uuid); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Session %s is network-bridged with %s\n", my_uuid, network_peer_uuid); + + switch_core_session_rwunlock(network_peer); + } + } + caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); caller_profile->destination_number = switch_core_strdup(caller_profile->pool, switch_str_nil(dest_num)); caller_profile->caller_id_number = switch_core_strdup(caller_profile->pool, switch_str_nil(callerid_num)); @@ -1617,7 +1637,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } else { cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } - goto fail; + goto fail; } return SWITCH_CAUSE_SUCCESS; @@ -1746,6 +1766,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session if (globals.sip_headers) { switch_channel_set_variable(channel, "sip_h_X-FreeTDM-SpanName", ftdm_channel_get_span_name(sigmsg->channel)); + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-TransUUID", "%s",switch_core_session_get_uuid(session)); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-SpanNumber", "%d", spanid); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ChanNumber", "%d", chanid); 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 fbfab15d1e..0c8cf3832a 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 @@ -58,6 +58,15 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) if (sngss7_info->circuit->transparent_iam && sngss7_retrieve_iam(ftdmchan, &iam) == FTDM_SUCCESS) { SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM (Transparent)\n", sngss7_info->circuit->cic); + + /* Called Number information */ + copy_cdPtyNum_to_sngss7(ftdmchan, &iam.cdPtyNum); + + /* Redirecting Number */ + copy_redirgNum_to_sngss7(ftdmchan, &iam.redirgNum); + + /* Redirecting Information */ + copy_redirgInfo_to_sngss7(ftdmchan, &iam.redirInfo); } else { /* Nature of Connection Indicators */ copy_natConInd_to_sngss7(ftdmchan, &iam.natConInd);