FS-5620 --resolve

This commit is contained in:
Anthony Minessale 2013-07-19 21:50:55 -05:00
parent 6e764c82a3
commit dcd15ff1c0
3 changed files with 33 additions and 26 deletions

View File

@ -57,6 +57,9 @@
SWITCH_BEGIN_EXTERN_C 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 { typedef struct profile_node_s {
char *var; char *var;
char *val; char *val;

View File

@ -8012,6 +8012,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"); 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) { if (sip->sip_from && sip->sip_from->a_url) {
from_user = sip->sip_from->a_url->url_user; from_user = sip->sip_from->a_url->url_user;
from_host = sip->sip_from->a_url->url_host; from_host = sip->sip_from->a_url->url_host;
@ -8534,10 +8555,15 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
check_decode(displayname, session); check_decode(displayname, session);
tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
from_user, profile_dup_clean(from_user, tech_pvt->caller_profile->username, tech_pvt->caller_profile->pool);
dialplan, profile_dup_clean(dialplan, tech_pvt->caller_profile->dialplan, tech_pvt->caller_profile->pool);
displayname, from_user, network_ip, from_user, aniii, NULL, MODNAME, context, destination_number); 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 && sip->sip_replaces) {
if (!(bnh = nua_handle_by_replaces(nua, sip->sip_replaces))) { if (!(bnh = nua_handle_by_replaces(nua, sip->sip_replaces))) {
@ -8755,27 +8781,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->sofia_private = sofia_private;
tech_pvt->nh = nh; tech_pvt->nh = nh;

View File

@ -33,9 +33,6 @@
#include <switch.h> #include <switch.h>
#include <switch_caller.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, SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool,
const char *username, const char *username,
const char *dialplan, const char *dialplan,