update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2897 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
882c00d615
commit
ca7c2168ce
|
@ -2204,45 +2204,48 @@ static void sip_r_register(int status,
|
||||||
oreg = profile->registrations;
|
oreg = profile->registrations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!oreg) {
|
if (!oreg) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No authentication available!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No authentication available!\n");
|
||||||
|
nua_handle_destroy(nh);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sip->sip_www_authenticate) {
|
if (sip->sip_www_authenticate) {
|
||||||
authenticate = sip->sip_www_authenticate;
|
authenticate = sip->sip_www_authenticate;
|
||||||
} else if (sip->sip_proxy_authenticate) {
|
} else if (sip->sip_proxy_authenticate) {
|
||||||
authenticate = sip->sip_proxy_authenticate;
|
authenticate = sip->sip_proxy_authenticate;
|
||||||
}
|
}
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WTF status = '%d'\n", status);
|
||||||
if (authenticate) {
|
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 *realm = (char const *) *authenticate->au_params;
|
||||||
char const *scheme = (char const *) authenticate->au_scheme;
|
char const *scheme = (char const *) authenticate->au_scheme;
|
||||||
char authentication[256] = "";
|
char authentication[256] = "";
|
||||||
int ss_state;
|
int ss_state;
|
||||||
|
|
||||||
snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, strstr(realm, "=") + 1,
|
snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, strstr(realm, "=") + 1,
|
||||||
oreg->register_username,
|
oreg->register_username,
|
||||||
oreg->register_password);
|
oreg->register_password);
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n",
|
||||||
profile->username, authentication);
|
profile->username, authentication);
|
||||||
|
|
||||||
|
|
||||||
ss_state = nua_callstate_authenticating;
|
ss_state = nua_callstate_authenticating;
|
||||||
|
|
||||||
tl_gets(tags,
|
tl_gets(tags,
|
||||||
NUTAG_CALLSTATE_REF(ss_state),
|
NUTAG_CALLSTATE_REF(ss_state),
|
||||||
SIPTAG_WWW_AUTHENTICATE_REF(authenticate),
|
SIPTAG_WWW_AUTHENTICATE_REF(authenticate),
|
||||||
TAG_END());
|
TAG_END());
|
||||||
|
|
||||||
nua_authenticate(nh, NUTAG_AUTH(authentication), 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);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "registered %s\n", oregp->name);
|
||||||
oregp->expires = now + oregp->freq;
|
oregp->expires = now + oregp->freq;
|
||||||
oregp->state = REG_STATE_REGED;
|
oregp->state = REG_STATE_REGED;
|
||||||
oregp->retry = 0;
|
|
||||||
break;
|
break;
|
||||||
case REG_STATE_UNREGED:
|
case REG_STATE_UNREGED:
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "registering %s\n", oregp->name);
|
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),
|
SIPTAG_EXPIRES_STR(oregp->expires_str),
|
||||||
NUTAG_REGISTRAR(oregp->register_proxy),
|
NUTAG_REGISTRAR(oregp->register_proxy),
|
||||||
TAG_NULL());
|
TAG_NULL());
|
||||||
oregp->state = REG_STATE_TRYING;
|
|
||||||
oregp->retry = now + 10;
|
oregp->retry = now + 10;
|
||||||
|
oregp->state = REG_STATE_TRYING;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
|
case REG_STATE_TRYING:
|
||||||
if (oregp->retry && now >= oregp->retry) {
|
if (oregp->retry && now >= oregp->retry) {
|
||||||
oregp->state = REG_STATE_UNREGED;
|
oregp->state = REG_STATE_UNREGED;
|
||||||
oregp->retry = 0;
|
oregp->retry = 0;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
if (oregp->expires && now >= oregp->expires) {
|
if (oregp->expires && now >= oregp->expires) {
|
||||||
oregp->state = REG_STATE_UNREGED;
|
oregp->state = REG_STATE_UNREGED;
|
||||||
oregp->expires = 0;
|
oregp->expires = 0;
|
||||||
|
|
Loading…
Reference in New Issue