Merge pull request #674 in FS/freeswitch from ~LAZEDO/freeswitch:feature/FS-8763 to master

* commit 'f80d6cc5517c6886dc15dc446c0519811c55d04e':
  FS-8763 [mod_sofia] set is_auth on switch_ivr_set_user result
This commit is contained in:
Mike Jerris 2016-01-21 12:00:14 -06:00
commit 93f0da09d3
2 changed files with 13 additions and 3 deletions

View 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

View File

@ -4193,6 +4193,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);
@ -5471,6 +5472,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);
}
}
}
@ -9436,6 +9443,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++;
@ -9443,10 +9451,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 &&