handle BYE instead of CANCEL from callers (issue #4994)
authorKevin P. Fleming <kpfleming@digium.com>
Mon, 22 Aug 2005 19:47:00 +0000 (19:47 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Mon, 22 Aug 2005 19:47:00 +0000 (19:47 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6354 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 83c882e..451a4a2 100755 (executable)
@@ -9339,12 +9339,15 @@ static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req, int
 }
 
 /*--- handle_request_bye: Handle incoming BYE request ---*/
-static int handle_request_bye(struct sip_pvt *p, struct sip_request *req, int debug)
+static int handle_request_bye(struct sip_pvt *p, struct sip_request *req, int debug, int ignore)
 {
        struct ast_channel *c=NULL;
        int res;
        struct ast_channel *bridged_to;
        char iabuf[INET_ADDRSTRLEN];
+       
+       if (p->pendinginvite && !ast_test_flag(p, SIP_OUTGOING) && !ignore)
+               transmit_response_reliable(p, "487 Request Terminated", &p->initreq, 1);
 
        copy_request(&p->initreq, req);
        check_via(p, req);
@@ -9668,7 +9671,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
                res = handle_request_cancel(p, req, debug, ignore);
                break;
        case SIP_BYE:
-               res = handle_request_bye(p, req, debug);
+               res = handle_request_bye(p, req, debug, ignore);
                break;
        case SIP_MESSAGE:
                res = handle_request_message(p, req, debug, ignore);