From f2a260d81fb2736bd6f6f3e768087c9ccff94123 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Mar 2013 10:58:17 -0500 Subject: [PATCH] FS-5171 Please try this. Get a similar trace and if you can, compare it to the trace without the SBC in place. --- src/mod/endpoints/mod_sofia/sofia_presence.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f49b138566..09f6fcc801 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3530,6 +3530,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, const char *contact_port = NULL; sofia_nat_parse_t np = { { 0 } }; int found_proto = 0; + const char *use_to_tag; char to_tag[13] = ""; char buf[32] = ""; int subbed = 0; @@ -3547,7 +3548,12 @@ void sofia_presence_handle_sip_i_subscribe(int status, return; } - switch_stun_random_string(to_tag, 12, NULL); + if (sip->sip_to && sip->sip_to->a_tag) { + use_to_tag = sip->sip_to->a_tag; + } else { + switch_stun_random_string(to_tag, 12, NULL); + use_to_tag = to_tag; + } if ( sip->sip_contact && sip->sip_contact->m_url ) { contact_host = sip->sip_contact->m_url->url_host; @@ -3711,7 +3717,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, event, contact_str, call_id, full_from, full_via, (long) switch_epoch_time_now(NULL) + exp_delta, full_agent, accept, profile->name, mod_sofia_globals.hostname, - np.network_port, np.network_ip, orig_proto, full_to, to_tag); + np.network_port, np.network_ip, orig_proto, full_to, use_to_tag); switch_assert(sql != NULL); @@ -3819,7 +3825,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, } } - sip_to_tag(nh->nh_home, sip->sip_to, to_tag); + sip_to_tag(nh->nh_home, sip->sip_to, use_to_tag); if (mod_sofia_globals.debug_presence > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to SUBSCRIBE with 202 Accepted\n");