]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8763 [mod_sofia] set is_auth on switch_ivr_set_user result
authorLuis Azedo <luis@2600hz.com>
Wed, 20 Jan 2016 16:09:17 +0000 (16:09 +0000)
committerLuis Azedo <luis@2600hz.com>
Wed, 20 Jan 2016 16:09:17 +0000 (16:09 +0000)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 9038b8cf3f99e5b9daccc6f0ba88599e3badebda..dc066471519504f5a3ebd416208ce80948a0675e 100644 (file)
@@ -291,6 +291,7 @@ typedef enum {
        PFLAG_PROXY_REFER,
        PFLAG_CHANNEL_XML_FETCH_ON_NIGHTMARE_TRANSFER,
        PFLAG_FIRE_TRANFER_EVENTS,
+       PFLAG_BLIND_AUTH_ENFORCE_RESULT,
 
        /* No new flags below this line */
        PFLAG_MAX
index 98067676befd3ed0b043a6dfe2d5ba5bbff328f4..5c6658b57beb28ab8ad8d710e51a6f1a2aa7e984 100644 (file)
@@ -4191,6 +4191,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
 
                                        sofia_clear_pflag(profile, PFLAG_CHANNEL_XML_FETCH_ON_NIGHTMARE_TRANSFER);
                                        sofia_clear_pflag(profile, PFLAG_FIRE_TRANFER_EVENTS);
+                                       sofia_clear_pflag(profile, PFLAG_BLIND_AUTH_ENFORCE_RESULT);
                                        profile->shutdown_type = "false";
                                        profile->local_network = "localnet.auto";
                                        sofia_set_flag(profile, TFLAG_ENABLE_SOA);
@@ -5469,6 +5470,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                                }  else {
                                                        sofia_clear_pflag(profile, PFLAG_FIRE_TRANFER_EVENTS);
                                                }
+                                        } else if (!strcasecmp(var, "enforce-blind-auth-result")) {
+                                                if(switch_true(val)) {
+                                                        sofia_set_pflag(profile, PFLAG_BLIND_AUTH_ENFORCE_RESULT);
+                                                }  else {
+                                                        sofia_clear_pflag(profile, PFLAG_BLIND_AUTH_ENFORCE_RESULT);
+                                                }
                                        }
                                }
 
@@ -9434,6 +9441,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
 
        if (!is_auth && sofia_test_pflag(profile, PFLAG_AUTH_CALLS) && sofia_test_pflag(profile, PFLAG_BLIND_AUTH)) {
                char *user;
+               switch_status_t blind_result = SWITCH_STATUS_FALSE;
 
                if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
                        calling_myself++;
@@ -9441,10 +9449,11 @@ 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);
-                       switch_ivr_set_user(session, user);
+                       blind_result = switch_ivr_set_user(session, user);
+               }
+               if(!sofia_test_pflag(profile, PFLAG_BLIND_AUTH_ENFORCE_RESULT) || blind_result == SWITCH_STATUS_SUCCESS) {
+                       is_auth++;
                }
-
-               is_auth++;
        }
 
        if (!is_auth &&