freetdm: Tweaks to SS7 native bridge feature

- Enable native bridge also when receiving the UUID via SIP header
         - Remove some debug CRIT messages and set a more proper log level
This commit is contained in:
Moises Silva 2012-01-26 23:51:21 -05:00
parent 9fc8395b31
commit 1aa4f87b6a
4 changed files with 26 additions and 16 deletions

View File

@ -1260,6 +1260,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
const char *var;
const char *dest_num = NULL, *callerid_num = NULL;
const char *network_peer_uuid = NULL;
char sigbridge_peer[255];
switch_channel_t *peer_chan = NULL;
switch_channel_t *our_chan = NULL;
ftdm_hunting_scheme_t hunting;
ftdm_usrmsg_t usrmsg;
@ -1613,6 +1616,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
goto fail;
}
our_chan = switch_core_session_get_channel(*new_session);
if (network_peer_uuid) {
switch_core_session_t *network_peer = switch_core_session_locate(network_peer_uuid);
if (network_peer) {
@ -1621,8 +1626,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
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_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session %s is network-bridged with %s\n",
my_uuid, network_peer_uuid);
snprintf(sigbridge_peer, sizeof(sigbridge_peer), "%u:%u",
ftdm_channel_get_span_id(peer_private->ftdmchan), ftdm_channel_get_id(peer_private->ftdmchan));
switch_core_session_rwunlock(network_peer);
}
}
@ -1642,15 +1650,13 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
&& (var = channel_get_variable(session, var_event, FREETDM_VAR_PREFIX "native_sigbridge"))
&& switch_true(var)
&& switch_core_session_compare(*new_session, session)) {
char sigbridge_peer[255];
private_t *peer_pvt = switch_core_session_get_private(session);
switch_channel_t *peer_chan = switch_core_session_get_channel(session);
switch_channel_t *our_chan = switch_core_session_get_channel(*new_session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
"Bridging native signaling of channel %s to channel %s\n",
switch_channel_get_name(peer_chan), switch_channel_get_name(our_chan));
snprintf(sigbridge_peer, sizeof(sigbridge_peer), "%u:%u",
ftdm_channel_get_span_id(peer_pvt->ftdmchan), ftdm_channel_get_id(peer_pvt->ftdmchan));
}
if (!zstr(sigbridge_peer)) {
peer_chan = switch_core_session_get_channel(session);
ftdm_usrmsg_add_var(&usrmsg, "sigbridge_peer", sigbridge_peer);
}
@ -1672,6 +1678,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
goto fail;
}
if (our_chan && peer_chan) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
"Bridging native signaling of channel %s to channel %s\n",
switch_channel_get_name(peer_chan), switch_channel_get_name(our_chan));
}
return SWITCH_CAUSE_SUCCESS;
}

View File

@ -2520,7 +2520,6 @@ static ftdm_status_t _ftdm_channel_call_place_nl(const char *file, const char *f
if (var) {
ftdm_span_t *peer_span = NULL;
ftdm_channel_t *peer_chan = NULL;
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "enabling native signaling bridge!\n");
ftdm_set_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE);
ftdm_get_channel_from_string(var, &peer_span, &peer_chan);
if (peer_chan) {

View File

@ -693,7 +693,7 @@ static void ftdm_sangoma_ss7_process_peer_stack_event (ftdm_channel_t *ftdmchan,
ftdm_channel_advance_states(ftdmchan);
}
SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]Relaying message %s from bridged peer\n",
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Relaying message %s from bridged peer\n",
sngss7_info->circuit->cic, ftdm_sngss7_event2str(sngss7_event->event_id));
switch (sngss7_event->event_id) {

View File

@ -79,7 +79,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
sngss7_info->peer_data = peer_info;
/* flush our own queue */
while ((event_clone = ftdm_queue_dequeue(sngss7_info->event_queue))) {
SS7_WARN("[CIC:%d]Discarding clone event from past call!\n", sngss7_info->circuit->cic);
ftdm_safe_free(event_clone);
}
/* go up until release comes, note that state processing is done different and much simpler when there is a peer */