]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9735 - send unknown headers to switch_ivr_set_user
authorLuis Azedo <luis@2600hz.com>
Mon, 14 Nov 2016 17:18:32 +0000 (17:18 +0000)
committerLuis Azedo <luis@2600hz.com>
Mon, 14 Nov 2016 17:18:32 +0000 (17:18 +0000)
creeates switch_ivr_set_user_extended to receive params to pass to xml_locate_user

src/include/switch_ivr.h
src/mod/endpoints/mod_sofia/sofia.c
src/switch_ivr.c

index 712179d7838b56fb9685adf3ec60b95b0eaaaeb2..c675fe3da8981c149c3c935ea0a97c2bfb43a2d7 100644 (file)
@@ -961,6 +961,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_ip(switch_core_session_t *session
                                                                                                  switch_input_args_t *args);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data);
+SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_extended(switch_core_session_t *session, const char *data, switch_event_t *params);
 SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_xml(switch_core_session_t *session, const char *prefix,
                                                                                                                const char *user, const char *domain, switch_xml_t x_user);
 
index a7833b16c6b57dc59ec54d19e7c8dacc25c0a8a8..9715df7d4fa262c305b3426a00f71ba50e1f38c2 100644 (file)
@@ -9965,7 +9965,12 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
 
                if (sip && sip->sip_from) {
                        user = switch_core_session_sprintf(session, "%s@%s", sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host);
-                       blind_result = switch_ivr_set_user(session, user);
+                       switch_event_create(&v_event, SWITCH_EVENT_REQUEST_PARAMS);
+                       for (un = sip->sip_unknown; un; un = un->un_next) {
+                               switch_event_add_header_string(v_event, SWITCH_STACK_BOTTOM, un->un_name, un->un_value);
+                       };
+                       blind_result = switch_ivr_set_user_extended(session, user, v_event);
+                       switch_event_destroy(&v_event);
                }
                if(!sofia_test_pflag(profile, PFLAG_BLIND_AUTH_ENFORCE_RESULT) || blind_result == SWITCH_STATUS_SUCCESS) {
                        is_auth++;
index bed71c97c6e81d0a17cf7007f94ecf279cfe77f3..99728ab686451bdb2059eae78ad860a1cbf1e384 100644 (file)
@@ -3833,6 +3833,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_xml(switch_core_session_t *s
 }
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data)
+{
+       return switch_ivr_set_user_extended(session, data, NULL);
+}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_extended(switch_core_session_t *session, const char *data, switch_event_t *params)
 {
        switch_xml_t x_user = 0;
        char *user, *domain;
@@ -3856,8 +3861,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *sessi
 
        *domain++ = '\0';
 
-
-       if (switch_xml_locate_user_merged("id", user, domain, NULL, &x_user, NULL) != SWITCH_STATUS_SUCCESS) {
+       if (switch_xml_locate_user_merged("id", user, domain, NULL, &x_user, params) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", user, domain);
                goto done;
        }