]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
4579 tweaks
authorAnthony Minessale <anthm@freeswitch.org>
Sun, 5 Aug 2012 21:45:14 +0000 (16:45 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Sun, 5 Aug 2012 21:45:14 +0000 (16:45 -0500)
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_presence.c

index c7464e20bd82d7cf4c384a303191a330ffaee0d0..a3add9c434307b34f41463b499188cef2064431e 100644 (file)
@@ -1263,10 +1263,15 @@ static void our_sofia_event_callback(nua_event_t event,
                                referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_referred_by), 0);
                                ref_by_user = sip->sip_referred_by->b_url->url_user;
                        }
+            else if(sip->sip_to && sip->sip_to->a_url)
+            {
+                               referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_to), 0);
+                ref_by_user = sip->sip_to->a_url->url_user;
+            }
 
-                       if (sip->sip_request && sip->sip_request->rq_url) {
-                               req_user = sip->sip_request->rq_url->url_user;
-                               req_host = sip->sip_request->rq_url->url_host;
+                       if (sip->sip_to && sip->sip_to->a_url) {
+                               req_user = sip->sip_to->a_url->url_user;
+                               req_host = sip->sip_to->a_url->url_host;
                        }
 
                        if (switch_event_create(&event, SWITCH_EVENT_CALL_SETUP_REQ) == SWITCH_STATUS_SUCCESS) {
@@ -1355,7 +1360,7 @@ static void our_sofia_event_callback(nua_event_t event,
                                sip_to_tag(nh->nh_home, sip->sip_to, to_tag);
                        }
                        
-                       nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
+                       nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_TO(sip->sip_to), NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
                        switch_safe_free(method);
                        switch_safe_free(full_url);
 
index f116cd2ee0aa5310ce82d78dc2922cc33c10e031..23db7d00946a8364a596422e206e2e42c8bd7c78 100644 (file)
@@ -930,20 +930,6 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event
                sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
        }
 
-
-       if (switch_true(final)) {
-               sql = switch_mprintf("delete from sip_subscriptions where "
-                                                        "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'",
-                                                        mod_sofia_globals.hostname, profile->name,
-                                                        from_user, from_host, event_str);
-
-               sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
-       }
-
-
-
-
-
        if (call_id) {
                sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, "
                                                         "'%q' as ct,'%q' as pt "
@@ -968,6 +954,15 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event
        }
 
        sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_send_sql, &cb);
+
+       if (switch_true(final)) {
+               sql = switch_mprintf("delete from sip_subscriptions where "
+                                                        "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'",
+                                                        mod_sofia_globals.hostname, profile->name,
+                                                        from_user, from_host, event_str);
+
+               sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+       }
        switch_safe_free(sql);
 
 }