From 637cd993e0f0747c9ae568c3e198627262d0fe90 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 17 Jun 2015 10:34:35 -0500 Subject: [PATCH] FS-7650: #resolve [mod_verto] Fix crash when making a call from a verto user with profile-variables in their user profile --- src/mod/endpoints/mod_verto/mod_verto.c | 4 ++-- src/switch_ivr.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 8afe2fb5f0..ab7efd2812 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3243,8 +3243,6 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock err = 1; goto cleanup; } - switch_ivr_set_user(session, jsock->uid); - channel = switch_core_session_get_channel(session); switch_channel_set_direction(channel, SWITCH_CALL_DIRECTION_INBOUND); @@ -3319,6 +3317,8 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock } + switch_ivr_set_user(session, jsock->uid); + switch_channel_set_profile_var(channel, "callee_id_name", remote_caller_id_name); switch_channel_set_profile_var(channel, "callee_id_number", remote_caller_id_number); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 17289cec2e..026b282edd 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -3274,7 +3274,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_xml(switch_core_session_t *s } } - if ((x_params = switch_xml_child(x_user, "profile-variables"))) { + if (switch_channel_get_caller_profile(channel) && (x_params = switch_xml_child(x_user, "profile-variables"))) { for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { const char *var = switch_xml_attr(x_param, "name"); const char *val = switch_xml_attr(x_param, "value");