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

View File

@ -4115,7 +4115,8 @@ static void sip_r_register(int status,
outbound_reg_t *oreg = NULL; outbound_reg_t *oreg = NULL;
sip_www_authenticate_t const *authenticate = NULL; sip_www_authenticate_t const *authenticate = NULL;
switch_core_session_t *session = sofia_private ? sofia_private->session : NULL; switch_core_session_t *session = sofia_private ? sofia_private->session : NULL;
char const *realm = NULL; char const *realm = NULL;
char *p = NULL, *qrealm = NULL;
char const *scheme = NULL; char const *scheme = NULL;
int index; int index;
char *cur; char *cur;
@ -4149,10 +4150,21 @@ static void sip_r_register(int status,
if (!(scheme && realm)) { if (!(scheme && realm)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No scheme and realm!\n"); 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) {
if (sofia_private->oreg) { if (sofia_private->oreg) {
@ -4160,18 +4172,20 @@ static void sip_r_register(int status,
} else if (profile) { } else if (profile) {
outbound_reg_t *oregp; outbound_reg_t *oregp;
for (oregp = profile->registrations; oregp; oregp = oregp->next) { 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; oreg = oregp;
break; break;
} }
} }
if (!oreg) { 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) { if (!oreg) {
return; return;
} }