reg realm stuff

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3398 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-11-17 22:13:26 +00:00
parent 5af884576c
commit 6dd370b007
1 changed files with 18 additions and 4 deletions

View File

@ -4116,6 +4116,7 @@ static void sip_r_register(int status,
sip_www_authenticate_t const *authenticate = NULL;
switch_core_session_t *session = sofia_private ? sofia_private->session : NULL;
char const *realm = NULL;
char *p = NULL, *qrealm = NULL;
char const *scheme = NULL;
int index;
char *cur;
@ -4149,10 +4150,21 @@ static void sip_r_register(int status,
if (!(scheme && realm)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No scheme and realm!\n");
return;
}
}
if (!(scheme && realm)) {
return;
}
qrealm = strdup(realm);
while(*qrealm && *qrealm == '"') {
*qrealm++;
}
if ((p = strchr(qrealm, '"'))) {
*p = '\0';
}
if (sofia_private) {
if (sofia_private->oreg) {
@ -4160,18 +4172,20 @@ static void sip_r_register(int status,
} else if (profile) {
outbound_reg_t *oregp;
for (oregp = profile->registrations; oregp; oregp = oregp->next) {
if (scheme && realm && !strcasecmp(oregp->register_scheme, scheme) && !strcasecmp(oregp->register_realm, realm)) {
if (scheme && qrealm && !strcasecmp(oregp->register_scheme, scheme) && !strcasecmp(oregp->register_realm, qrealm)) {
oreg = oregp;
break;
}
}
if (!oreg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Match for Scheme [%s] Realm [%s]\n", scheme, realm);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Match for Scheme [%s] Realm [%s]\n", scheme, qrealm);
}
}
}
switch_safe_free(qrealm);
if (!oreg) {
return;
}