]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5620 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 20 Jul 2013 02:50:55 +0000 (21:50 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Sat, 20 Jul 2013 02:51:18 +0000 (21:51 -0500)
src/include/switch_caller.h
src/mod/endpoints/mod_sofia/sofia.c
src/switch_caller.c

index f21265e581a4bc5c0a3c3062ac791b44c776e111..f0dc1c76fef398a29cffab2424ec1d1612b9e58f 100644 (file)
@@ -57,6 +57,9 @@
 
 SWITCH_BEGIN_EXTERN_C
 
+#define profile_dup(a,b,p) if (!zstr(a)) { b = switch_core_strdup(p, a); } else { b = SWITCH_BLANK_STRING; }
+#define profile_dup_clean(a,b,p) if (!zstr(a)) { b = switch_var_clean_string(switch_clean_string(switch_core_strdup(p, a)));} else { b = SWITCH_BLANK_STRING; }
+
 typedef struct profile_node_s {
        char *var;
        char *val;
index 1a43fe6abeaf5c7fcb975f00006fb4931f400473..55847d19bf8893dd02149dece1ddb40b5a07a5b9 100644 (file)
@@ -8090,6 +8090,27 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                switch_channel_set_variable(channel, "sip_looped_call", "true");
        }
 
+       tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
+                                                                                                                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, MODNAME, NULL, NULL);
+       switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
+
+       if (x_user) {
+               const char *user = NULL, *domain = NULL;
+
+               if (v_event) {
+                       user = switch_event_get_header(v_event, "username");
+                       domain = switch_event_get_header(v_event, "domain_name");
+               }
+
+               switch_ivr_set_user_xml(session, NULL, user, domain, x_user);
+               switch_xml_free(x_user);
+               x_user = NULL;
+       }
+
+       if (v_event) {
+               switch_event_destroy(&v_event);
+       }
+
        if (sip->sip_from && sip->sip_from->a_url) {
                from_user = sip->sip_from->a_url->url_user;
                from_host = sip->sip_from->a_url->url_host;
@@ -8612,10 +8633,15 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
 
 
        check_decode(displayname, session);
-       tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
-                                                                                                                from_user,
-                                                                                                                dialplan,
-                                                                                                                displayname, from_user, network_ip, from_user, aniii, NULL, MODNAME, context, destination_number);
+
+       profile_dup_clean(from_user, tech_pvt->caller_profile->username, tech_pvt->caller_profile->pool);
+       profile_dup_clean(dialplan, tech_pvt->caller_profile->dialplan, tech_pvt->caller_profile->pool);
+       profile_dup_clean(displayname, tech_pvt->caller_profile->caller_id_name, tech_pvt->caller_profile->pool);
+       profile_dup_clean(from_user, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->pool);
+       profile_dup_clean(network_ip, tech_pvt->caller_profile->network_addr, tech_pvt->caller_profile->pool);
+       profile_dup_clean(aniii, tech_pvt->caller_profile->aniii, tech_pvt->caller_profile->pool);
+       profile_dup_clean(context, tech_pvt->caller_profile->context, tech_pvt->caller_profile->pool);
+       profile_dup_clean(destination_number, tech_pvt->caller_profile->destination_number, tech_pvt->caller_profile->pool);
 
        if (!bnh && sip->sip_replaces) {
                if (!(bnh = nua_handle_by_replaces(nua, sip->sip_replaces))) {
@@ -8833,27 +8859,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                        }
                }
 
-               switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
        }
 
-       if (x_user) {
-               const char *user = NULL, *domain = NULL;
-
-               if (v_event) {
-                       user = switch_event_get_header(v_event, "username");
-                       domain = switch_event_get_header(v_event, "domain_name");
-               }
-
-               switch_ivr_set_user_xml(session, NULL, user, domain, x_user);
-               switch_xml_free(x_user);
-               x_user = NULL;
-       }
-
-       if (v_event) {
-               switch_event_destroy(&v_event);
-       }
-
-
        tech_pvt->sofia_private = sofia_private;
        tech_pvt->nh = nh;
 
index 5909f2b2d5382c6eb9cbc5b590b9368f644959d7..d0c4ec87d32abb01171e243c198c2a7b31c50bb7 100644 (file)
@@ -33,9 +33,6 @@
 #include <switch.h>
 #include <switch_caller.h>
 
-#define profile_dup(a,b,p) if (!zstr(a)) { b = switch_core_strdup(p, a); } else { b = SWITCH_BLANK_STRING; }
-#define profile_dup_clean(a,b,p) if (!zstr(a)) { b = switch_var_clean_string(switch_clean_string(switch_core_strdup(p, a)));} else { b = SWITCH_BLANK_STRING; }
-
 SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool,
                                                                                                                                        const char *username,
                                                                                                                                        const char *dialplan,