diff options
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsip-ua/sip_inv.h | 1 | ||||
-rw-r--r-- | pjsip/src/pjsip-ua/sip_inv.c | 15 |
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 */ |