]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5171 Please try this. Get a similar trace and if you can, compare it to the trace...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 14 Mar 2013 15:58:17 +0000 (10:58 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 14 Mar 2013 15:58:17 +0000 (10:58 -0500)
src/mod/endpoints/mod_sofia/sofia_presence.c

index f49b138566d1bc997eda61dc4f7069120e87015d..09f6fcc801a5b753c148b2130845bc018c05bee7 100644 (file)
@@ -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");