diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index bdca8871795839502a3578c9656ea90e25f08795..147ebadd636fd9470d0244f289cb62ead61d897f 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -4071,8 +4071,11 @@ static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_trans ast_sip_session_send_request_with_cb(session, tdata, cb); SCOPE_EXIT_RTN("Sending authed reinvite\n"); } - if (tsx->status_code != 488 && tsx->status_code != 500) { - /* Other reinvite failures (except 488 and 500) result in destroying the session. */ + /* Per RFC3261 14.1 a response to a re-INVITE should only terminate + * the dialog if a 481 or 408 occurs. All other responses should leave + * the dialog untouched. + */ + if (tsx->status_code == 481 || tsx->status_code == 408) { if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS && tdata) { ast_sip_session_send_request(session, tdata);