diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h
index e7b1eb7b24..6906a7ba85 100644
--- a/src/include/switch_xml.h
+++ b/src/include/switch_xml.h
@@ -322,7 +322,8 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(char *user_name, char *do
 													   char *ip, 
 													   switch_xml_t *root,
 													   switch_xml_t *domain,
-													   switch_xml_t *user);
+													   switch_xml_t *user,
+													   char *profile_name);
 
 ///\brief open a config in the core registry
 ///\param file_path the name of the config section e.g. modules.conf
diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c
index e6916fe62c..60c8af3dc5 100644
--- a/src/mod/endpoints/mod_sofia/sofia_reg.c
+++ b/src/mod/endpoints/mod_sofia/sofia_reg.c
@@ -816,7 +816,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t co
 		free(sql);
 	} 
 	
-	if (switch_xml_locate_user(username, realm, ip, &xml, &domain, &user) != SWITCH_STATUS_SUCCESS) {
+	if (switch_xml_locate_user(username, realm, ip, &xml, &domain, &user, profile->name) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", username, realm);
 		ret = AUTH_FORBIDDEN;
 		goto end;
diff --git a/src/switch_xml.c b/src/switch_xml.c
index 82a3a0810a..d33ce357b1 100644
--- a/src/switch_xml.c
+++ b/src/switch_xml.c
@@ -1201,7 +1201,8 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(char *user_name, char *do
 													   char *ip, 
 													   switch_xml_t *root,
 													   switch_xml_t *domain,
-													   switch_xml_t *user)
+													   switch_xml_t *user,
+													   char *profile_name)
 {
 	char params[1024] = "";
 	switch_status_t status;
@@ -1209,7 +1210,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(char *user_name, char *do
 	*user = NULL;
 	*domain = NULL;
 	
-	snprintf(params, sizeof(params), "user=%s&domain=%s&ip=%s", switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip));
+	snprintf(params, sizeof(params), "user=%s&domain=%s&ip=%s&profile=%s", switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip), profile_name);
 	if ((status = switch_xml_locate_domain(domain_name, params, root, domain)) != SWITCH_STATUS_SUCCESS) {
 		return status;
 	}