From 56c7bd079294662092a6570b68781b0f562b0bb6 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 23 May 2007 07:12:23 +0000 Subject: Fixed ticket #288: ICE role error on re-INVITE and ICE auth error when sending 487 (Role Conflict) response git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1291 74dad513-b988-da41-8d7b-12977e46ad98 --- pjnath/src/pjnath/ice_session.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'pjnath') diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c index 246e4564..6e5d40f6 100644 --- a/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c @@ -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 */ -- cgit v1.2.3