]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_session: Allow BYE to be sent on disconnected session.
authorJoshua Colp <jcolp@digium.com>
Fri, 31 Mar 2017 21:31:24 +0000 (21:31 +0000)
committerJoshua Colp <jcolp@digium.com>
Sat, 1 Apr 2017 10:58:41 +0000 (10:58 +0000)
It is perfectly acceptable for a BYE to be sent on a disconnected
session. This occurs when we respond to a challenge to the BYE
for authentication credentials.

ASTERISK-26363

Change-Id: I6ef0ddece812fea6665a1dd2549ef44fb9d90045

res/res_pjsip_session.c

index 53841c44af1e0506b49325a30bda3b70d4bbcdc2..0a18a8018740f2bf6835702bb3d50f9032b5cea8 100644 (file)
@@ -1198,8 +1198,13 @@ void ast_sip_session_send_request_with_cb(struct ast_sip_session *session, pjsip
 {
        pjsip_inv_session *inv_session = session->inv_session;
 
-       if (inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
-               /* Don't try to do anything with a hung-up call */
+       /* For every request except BYE we disallow sending of the message when
+        * the session has been disconnected. A BYE request is special though
+        * because it can be sent again after the session is disconnected except
+        * with credentials.
+        */
+       if (inv_session->state == PJSIP_INV_STATE_DISCONNECTED &&
+               tdata->msg->line.req.method.id != PJSIP_BYE_METHOD) {
                return;
        }