]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Prevent chan_sip from sending duplicate BYEs.
authorMark Michelson <mmichelson@digium.com>
Tue, 15 Oct 2013 14:58:12 +0000 (14:58 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 15 Oct 2013 14:58:12 +0000 (14:58 +0000)
When a 200 OK for an initial INVITE is received, we were doing
the right thing by ACKing and sending an immediate BYE. However,
we also were doing the wrong thing and queuing an answer frame,
thus causing the call to be answered. This would cause the call
to be hung up by the channel thread, thus resulting in a second
BYE being sent out.

In this fix, I also have set the hangupcause to be correct since
the initial BYE being sent by Asterisk had an unknown hangup
cause. I have changed to using "Bearer capabilty not available"
since the call was hung up due to an SDP offer/answer error.

(closes issue ASTERISK-22621)
reported by Kinsey Moore
........

Merged revisions 400970 from http://svn.asterisk.org/svn/asterisk/branches/1.8

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

channels/chan_sip.c

index 0580ebb9f1be61720bc9e8f78645c4f28aaeb4ae..80d7151c020a4892cfad0e72db37202877415a55 100644 (file)
@@ -22788,12 +22788,16 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest
                }
                p->authtries = 0;
                if (find_sdp(req)) {
-                       if ((res = process_sdp(p, req, SDP_T38_ACCEPT)) && !req->ignore)
+                       if ((res = process_sdp(p, req, SDP_T38_ACCEPT)) && !req->ignore) {
                                if (!reinvite) {
                                        /* This 200 OK's SDP is not acceptable, so we need to ack, then hangup */
                                        /* For re-invites, we try to recover */
                                        ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
+                                       ast_channel_hangupcause_set(p->owner, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL);
+                                       p->hangupcause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
+                                       sip_queue_hangup_cause(p, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL);
                                }
+                       }
                        ast_rtp_instance_activate(p->rtp);
                } else if (!reinvite) {
                        struct ast_sockaddr remote_address = {{0,}};
@@ -22863,7 +22867,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest
                }
 
                if (!req->ignore && p->owner) {
-                       if (!reinvite) {
+                       if (!reinvite && !res) {
                                ast_queue_control(p->owner, AST_CONTROL_ANSWER);
                                if (sip_cfg.callevents) {
                                        manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",