summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2011-06-24 07:35:28 +0000
committerBenny Prijono <bennylp@teluu.com>2011-06-24 07:35:28 +0000
commit4af4b1d18fc506d4a6cbe23a3266531ce08e9514 (patch)
tree8a8cab63366e69ae486c778c6c17d4beb142e44c /pjsip
parent8ada88a46f864f776c411b71862b76a6b9fd6cce (diff)
Fixed #1318: Prevent PJSIP_INV_STATE_CALLING from being reported more than once (thanks Sam Yasin for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3598 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsip-ua/sip_inv.h1
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c15
2 files changed, 15 insertions, 1 deletions
diff --git a/pjsip/include/pjsip-ua/sip_inv.h b/pjsip/include/pjsip-ua/sip_inv.h
index e455a20f..dcd9638f 100644
--- a/pjsip/include/pjsip-ua/sip_inv.h
+++ b/pjsip/include/pjsip-ua/sip_inv.h
@@ -367,6 +367,7 @@ struct pjsip_inv_session
pjsip_status_code cause; /**< Disconnect cause. */
pj_str_t cause_text; /**< Cause text. */
pj_bool_t notify; /**< Internal. */
+ unsigned cb_called; /**< Cb has been called */
pjsip_dialog *dlg; /**< Underlying dialog. */
pjsip_role_e role; /**< Invite role. */
unsigned options; /**< Options in use. */
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index 377dc147..b377beb4 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -195,8 +195,18 @@ void inv_set_state(pjsip_inv_session *inv, pjsip_inv_state state,
pjsip_event *e)
{
pjsip_inv_state prev_state = inv->state;
+ pj_bool_t dont_notify = PJ_FALSE;
pj_status_t status;
+ /* Prevent STATE_CALLING from being reported more than once because
+ * of authentication
+ * https://trac.pjsip.org/repos/ticket/1318
+ */
+ if (state==PJSIP_INV_STATE_CALLING &&
+ (inv->cb_called & (1 << PJSIP_INV_STATE_CALLING)) != 0)
+ {
+ dont_notify = PJ_TRUE;
+ }
/* If state is confirmed, check that SDP negotiation is done,
* otherwise disconnect the session.
@@ -224,8 +234,11 @@ void inv_set_state(pjsip_inv_session *inv, pjsip_inv_state state,
pj_assert(inv->state != PJSIP_INV_STATE_DISCONNECTED ||
inv->cause != 0);
+ /* Mark the callback as called for this state */
+ inv->cb_called |= (1 << state);
+
/* Call on_state_changed() callback. */
- if (mod_inv.cb.on_state_changed && inv->notify)
+ if (mod_inv.cb.on_state_changed && inv->notify && !dont_notify)
(*mod_inv.cb.on_state_changed)(inv, e);
/* Only decrement when previous state is not already DISCONNECTED */