update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3417 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
02ca948e7a
commit
3a90756886
|
@ -4111,6 +4111,25 @@ static void sip_r_register(int status,
|
||||||
sofia_private_t *sofia_private,
|
sofia_private_t *sofia_private,
|
||||||
sip_t const *sip,
|
sip_t const *sip,
|
||||||
tagi_t tags[])
|
tagi_t tags[])
|
||||||
|
{
|
||||||
|
if (sofia_private && sofia_private->oreg) {
|
||||||
|
if (status == 200) {
|
||||||
|
sofia_private->oreg->state = REG_STATE_REGISTER;
|
||||||
|
} else {
|
||||||
|
sofia_private->oreg->state = REG_STATE_FAILED;
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "received %d on register!\n", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sip_r_challenge(int status,
|
||||||
|
char const *phrase,
|
||||||
|
nua_t *nua,
|
||||||
|
sofia_profile_t *profile,
|
||||||
|
nua_handle_t *nh,
|
||||||
|
sofia_private_t *sofia_private,
|
||||||
|
sip_t const *sip,
|
||||||
|
tagi_t tags[])
|
||||||
{
|
{
|
||||||
outbound_reg_t *oreg = NULL;
|
outbound_reg_t *oreg = NULL;
|
||||||
sip_www_authenticate_t const *authenticate = NULL;
|
sip_www_authenticate_t const *authenticate = NULL;
|
||||||
|
@ -4131,16 +4150,7 @@ static void sip_r_register(int status,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sofia_private && sofia_private->oreg) {
|
|
||||||
oreg = sofia_private->oreg;
|
|
||||||
if (status == 200) {
|
|
||||||
oreg->state = REG_STATE_REGISTER;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (status == 401 || status == 407) {
|
|
||||||
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) {
|
||||||
|
@ -4210,7 +4220,7 @@ static void sip_r_register(int status,
|
||||||
TAG_END());
|
TAG_END());
|
||||||
|
|
||||||
nua_authenticate(nh, SIPTAG_EXPIRES_STR(oreg->expires_str), NUTAG_AUTH(authentication), TAG_END());
|
nua_authenticate(nh, SIPTAG_EXPIRES_STR(oreg->expires_str), NUTAG_AUTH(authentication), TAG_END());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void event_callback(nua_event_t event,
|
static void event_callback(nua_event_t event,
|
||||||
|
@ -4264,6 +4274,11 @@ static void event_callback(nua_event_t event,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status == 401 || status == 407) {
|
||||||
|
sip_r_challenge(status, phrase, nua, profile, nh, sofia_private, sip, tags);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case nua_r_shutdown:
|
case nua_r_shutdown:
|
||||||
//sip_r_shutdown(status, phrase, nua, profile, nh, sofia_private, sip, tags);
|
//sip_r_shutdown(status, phrase, nua, profile, nh, sofia_private, sip, tags);
|
||||||
|
@ -4274,6 +4289,8 @@ static void event_callback(nua_event_t event,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nua_r_invite:
|
case nua_r_invite:
|
||||||
|
break;
|
||||||
|
|
||||||
case nua_r_register:
|
case nua_r_register:
|
||||||
sip_r_register(status, phrase, nua, profile, nh, sofia_private, sip, tags);
|
sip_r_register(status, phrase, nua, profile, nh, sofia_private, sip, tags);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue