]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Only send a BYE when hanging up a channel that is up.
authorMark Michelson <mmichelson@digium.com>
Fri, 24 Jul 2009 18:26:50 +0000 (18:26 +0000)
committerMark Michelson <mmichelson@digium.com>
Fri, 24 Jul 2009 18:26:50 +0000 (18:26 +0000)
For cases where Asterisk sends an INVITE and receives a non 2XX final
response, Asterisk would follow the INVITE transaction by immediately
sending a BYE, which was unnecessary.

(closes issue #14575)
Reported by: chris-mac

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@208587 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 890904908be4330b290eb6a70df3ebfcf560da37..52f4708fda92cce36c892b70bb9658fb22d27f4b 100644 (file)
@@ -3726,7 +3726,9 @@ static int sip_hangup(struct ast_channel *ast)
                                if (p->vrtp)
                                        videoqos = ast_rtp_get_quality(p->vrtp, NULL);
                                /* Send a hangup */
-                               transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
+                               if (oldowner->_state == AST_STATE_UP) {
+                                       transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
+                               }
 
                                /* Get RTCP quality before end of call */
                                if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY)) {