summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-05-23 07:12:23 +0000
committerBenny Prijono <bennylp@teluu.com>2007-05-23 07:12:23 +0000
commit56c7bd079294662092a6570b68781b0f562b0bb6 (patch)
treee08823ea1b5b1d412ef2c37c8363037f1660d35b
parentff0ad1551351f97da64fcbc68e096d830995262c (diff)
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
-rw-r--r--pjnath/src/pjnath/ice_session.c30
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c2
2 files changed, 15 insertions, 17 deletions
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
*/
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index e1b6d278..247c3085 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -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();