]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_session: Don't aggressively terminate on failed re-INVITE.
authorJoshua C. Colp <jcolp@sangoma.com>
Tue, 18 Aug 2020 09:36:05 +0000 (06:36 -0300)
committerKevin Harwell <kharwell@digium.com>
Tue, 25 Aug 2020 18:38:49 +0000 (13:38 -0500)
Per the RFC when an outgoing re-INVITE is done we should
only terminate the dialog if a 481 or 408 is received.

ASTERISK-29033

Change-Id: I6c3ff513aa41005d02de0396ba820083e9b18503

res/res_pjsip_session.c

index 7df590932076deb4ec993979fc09e5652fe7f93c..c5298b2bfb32c2153defb63259053783eeb6eb01 100644 (file)
@@ -2887,8 +2887,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);
                                                        return;
                                                }
-                                               if (tsx->status_code != 488) {
-                                                       /* Other reinvite failures (except 488) 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);