diff options
author | Mark Michelson <mmichelson@digium.com> | 2015-08-28 12:29:25 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-08-28 12:29:26 -0500 |
commit | b5801fe42c37f4a9c075b2e96b108ce2344d23e9 (patch) | |
tree | e7a626ba4264974e70be020149632e5f12201251 /res/res_pjsip_session.c | |
parent | c2df44ad3ec8685126dd01af6be5bcbd135c1427 (diff) | |
parent | c2c73190825bf4c9cedb1031327199767a4a3ca8 (diff) |
Merge "res_pjsip_session: Don't invoke session supplements twice for BYE requests." into 13
Diffstat (limited to 'res/res_pjsip_session.c')
-rw-r--r-- | res/res_pjsip_session.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 52bbc1774..16ac640d9 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -2390,8 +2390,16 @@ static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_trans break; case PJSIP_EVENT_RX_MSG: cb = ast_sip_mod_data_get(tsx->mod_data, session_module.id, MOD_DATA_ON_RESPONSE); - handle_incoming(session, e->body.tsx_state.src.rdata, e->type, - AST_SIP_SESSION_AFTER_MEDIA); + /* As the PJSIP invite session implementation responds with a 200 OK before we have a + * chance to be invoked session supplements for BYE requests actually end up executing + * in the invite session state callback as well. To prevent session supplements from + * running on the BYE request again we explicitly squash invocation of them here. + */ + if ((e->body.tsx_state.src.rdata->msg_info.msg->type != PJSIP_REQUEST_MSG) || + (tsx->method.id != PJSIP_BYE_METHOD)) { + handle_incoming(session, e->body.tsx_state.src.rdata, e->type, + AST_SIP_SESSION_AFTER_MEDIA); + } if (tsx->method.id == PJSIP_INVITE_METHOD) { if (tsx->role == PJSIP_ROLE_UAC) { if (tsx->state == PJSIP_TSX_STATE_COMPLETED) { |