summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-02-18 02:12:22 +0000
committerBenny Prijono <bennylp@teluu.com>2012-02-18 02:12:22 +0000
commitaf0b29f972d2b03778daa66048a124428eb8d3d0 (patch)
tree106ae8a5ed3c1b6b3522fb5f28a4df7ce27659b3
parent5e23d504cd6a1da1d8bfc8365b3c4dbcd3c184f9 (diff)
Fixed #1452: Wrong call media state is reported if hold request is challenged with authentication (thanks Bogdan Krakowski for the fix)
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3954 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/include/pjsip/sip_transport.h7
-rw-r--r--pjsip/src/pjsip/sip_auth_client.c6
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c12
3 files changed, 24 insertions, 1 deletions
diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h
index a567d1a1..99f006a6 100644
--- a/pjsip/include/pjsip/sip_transport.h
+++ b/pjsip/include/pjsip/sip_transport.h
@@ -574,6 +574,13 @@ struct pjsip_tx_data
pjsip_tpselector tp_sel;
/**
+ * Special flag to indicate that this transmit data is a request that has
+ * been updated with proper authentication response and is ready to be
+ * sent for retry.
+ */
+ pj_bool_t auth_retry;
+
+ /**
* Arbitrary data attached by PJSIP modules.
*/
void *mod_data[PJSIP_MAX_MODULE];
diff --git a/pjsip/src/pjsip/sip_auth_client.c b/pjsip/src/pjsip/sip_auth_client.c
index 8684cc9b..4bde8539 100644
--- a/pjsip/src/pjsip/sip_auth_client.c
+++ b/pjsip/src/pjsip/sip_auth_client.c
@@ -1103,7 +1103,8 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess,
PJSIP_EINVALIDSTATUS);
tdata = old_request;
-
+ tdata->auth_retry = PJ_FALSE;
+
/*
* Respond to each authentication challenge.
*/
@@ -1174,6 +1175,9 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess,
/* Must invalidate the message! */
pjsip_tx_data_invalidate_msg(tdata);
+ /* Retrying.. */
+ tdata->auth_retry = PJ_TRUE;
+
/* Increment reference counter. */
pjsip_tx_data_add_ref(tdata);
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index 532bc12b..ed25da59 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -4326,6 +4326,18 @@ static void pjsua_call_on_tsx_state_changed(pjsip_inv_session *inv,
return;
}
+ /* https://trac.pjsip.org/repos/ticket/1452:
+ * If a request is retried due to 401/407 challenge, don't process the
+ * transaction first but wait until we've retried it.
+ */
+ if (tsx->role == PJSIP_ROLE_UAC &&
+ (tsx->status_code==401 || tsx->status_code==407) &&
+ tsx->last_tx && tsx->last_tx->auth_retry)
+ {
+ PJSUA_UNLOCK();
+ return;
+ }
+
/* Notify application callback first */
if (pjsua_var.ua_cfg.cb.on_call_tsx_state) {
(*pjsua_var.ua_cfg.cb.on_call_tsx_state)(call->index, tsx, e);