git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2897 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-09-30 16:30:29 +00:00
parent 882c00d615
commit ca7c2168ce
1 changed files with 23 additions and 18 deletions

View File

@ -2207,6 +2207,7 @@ static void sip_r_register(int status,
if (!oreg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No authentication available!\n");
nua_handle_destroy(nh);
return;
}
@ -2215,8 +2216,13 @@ static void sip_r_register(int status,
} else if (sip->sip_proxy_authenticate) {
authenticate = sip->sip_proxy_authenticate;
}
if (authenticate) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WTF status = '%d'\n", status);
if (status == 200) {
if (!sofia_private->session) {
oreg->state = REG_STATE_REGISTER;
}
nua_handle_destroy(nh);
} else if (authenticate) {
char const *realm = (char const *) *authenticate->au_params;
char const *scheme = (char const *) authenticate->au_scheme;
char authentication[256] = "";
@ -2234,15 +2240,12 @@ static void sip_r_register(int status,
tl_gets(tags,
NUTAG_CALLSTATE_REF(ss_state),
SIPTAG_WWW_AUTHENTICATE_REF(authenticate),
SIPTAG_WWW_AUTHENTICATE_REF(authenticate),
TAG_END());
nua_authenticate(nh, NUTAG_AUTH(authentication), TAG_END());
} else if (status == 200) {
if (!sofia_private->session) {
oreg->state = REG_STATE_REGISTER;
}
}
}
@ -2431,7 +2434,6 @@ static void check_oreg(sofia_profile_t *profile, time_t now)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "registered %s\n", oregp->name);
oregp->expires = now + oregp->freq;
oregp->state = REG_STATE_REGED;
oregp->retry = 0;
break;
case REG_STATE_UNREGED:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "registering %s\n", oregp->name);
@ -2449,15 +2451,18 @@ static void check_oreg(sofia_profile_t *profile, time_t now)
SIPTAG_EXPIRES_STR(oregp->expires_str),
NUTAG_REGISTRAR(oregp->register_proxy),
TAG_NULL());
oregp->state = REG_STATE_TRYING;
oregp->retry = now + 10;
oregp->state = REG_STATE_TRYING;
}
break;
default:
case REG_STATE_TRYING:
if (oregp->retry && now >= oregp->retry) {
oregp->state = REG_STATE_UNREGED;
oregp->retry = 0;
}
break;
default:
if (oregp->expires && now >= oregp->expires) {
oregp->state = REG_STATE_UNREGED;
oregp->expires = 0;