Fixed ticket #288: ICE role error on re-INVITE and ICE auth error when sending 487 (Role Conflict) response

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1291 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2007-05-23 07:12:23 +00:00
parent edd4ffa870
commit c9f6ea7052
2 changed files with 15 additions and 17 deletions

View File

@ -444,9 +444,7 @@ static pj_status_t stun_auth_get_cred(const pj_stun_msg *msg,
PJ_UNUSED_ARG(pool);
realm->slen = nonce->slen = 0;
if (PJ_STUN_IS_SUCCESS_RESPONSE(msg->hdr.type) ||
PJ_STUN_IS_ERROR_RESPONSE(msg->hdr.type))
{
if (PJ_STUN_IS_RESPONSE(msg->hdr.type)) {
/* Outgoing responses need to have the same credential as
* incoming requests.
*/
@ -1915,6 +1913,19 @@ static pj_status_t on_stun_rx_request(pj_stun_session *sess,
pj_stun_msg_find_attr(msg, PJ_STUN_ATTR_ICE_CONTROLLED, 0);
}
/* Handle the case when request comes before answer is received.
* We need to put credential in the response, and since we haven't
* got the response, copy the username from the request.
*/
if (ice->rcand_cnt == 0) {
pj_stun_string_attr *uname_attr;
uname_attr = (pj_stun_string_attr*)
pj_stun_msg_find_attr(msg, PJ_STUN_ATTR_USERNAME, 0);
pj_assert(uname_attr != NULL);
pj_strdup(ice->pool, &ice->rx_uname, &uname_attr->value);
}
/* 7.2.1.1. Detecting and Repairing Role Conflicts
*/
if (ice->role == PJ_ICE_SESS_ROLE_CONTROLLING &&
@ -1960,19 +1971,6 @@ static pj_status_t on_stun_rx_request(pj_stun_session *sess,
}
}
/* Handle the case when request comes before answer is received.
* We need to put credential in the response, and since we haven't
* got the response, copy the username from the request.
*/
if (ice->rcand_cnt == 0) {
pj_stun_string_attr *uname_attr;
uname_attr = (pj_stun_string_attr*)
pj_stun_msg_find_attr(msg, PJ_STUN_ATTR_USERNAME, 0);
pj_assert(uname_attr != NULL);
pj_strdup(ice->pool, &ice->rx_uname, &uname_attr->value);
}
/*
* First send response to this request
*/

View File

@ -2267,7 +2267,7 @@ static void pjsua_call_on_rx_offer(pjsip_inv_session *inv,
call->index));
/* Init media channel */
status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC);
status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Error initializing media channel", status);
PJSUA_UNLOCK();