]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Tracking down hanging channels, killing them one by one. Issue #9235 and related
authorOlle Johansson <oej@edvina.net>
Tue, 29 May 2007 16:02:50 +0000 (16:02 +0000)
committerOlle Johansson <oej@edvina.net>
Tue, 29 May 2007 16:02:50 +0000 (16:02 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@66404 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index cdc84e241c5108731f35b928ff5448f6d980829e..e93ee3782e4fbbfec68dc208652092e9c06d53f1 100644 (file)
@@ -1934,14 +1934,16 @@ static int retrans_pkt(void *data)
                        usleep(1);
                        ast_mutex_lock(&pkt->owner->lock);
                }
+               if (pkt->owner->owner) 
+                       pkt->owner->owner->hangupcause = AST_CAUSE_NO_USER_RESPONSE;
                if (pkt->method == SIP_BYE) {
                        /* Ok, we're not getting answers on SIP BYE's. Who cares?
                           let's take the call down anyway. */
-                       if (pkt->owner->owner)
+                       if (pkt->owner->owner) 
                                ast_channel_unlock(pkt->owner->owner);
                        append_history(pkt->owner, "ByeFailure", "Remote peer doesn't respond to bye. Destroying call anyway.");
                        ast_set_flag(&pkt->owner->flags[0], SIP_NEEDDESTROY);   
-               } if (pkt->owner->owner) {
+               } else if (pkt->owner->owner) {
                        sip_alreadygone(pkt->owner);
                        ast_log(LOG_WARNING, "Hanging up call %s - no reply to our critical packet.\n", pkt->owner->callid);
                        ast_queue_hangup(pkt->owner->owner);
@@ -1950,8 +1952,12 @@ static int retrans_pkt(void *data)
                        /* If no channel owner, destroy now */
 
                        /* Let the peerpoke system expire packets when the timer expires for poke_noanswer */
-                       if (pkt->method != SIP_OPTIONS)
+                       if (pkt->method != SIP_OPTIONS) {
                                ast_set_flag(&pkt->owner->flags[0], SIP_NEEDDESTROY);   
+                               sip_alreadygone(pkt->owner);
+                               if (option_debug)
+                                       append_history(pkt->owner, "DialogKill", "Killing this failed dialog immediately");
+                       }
                }
        }
        /* In any case, go ahead and remove the packet */
@@ -3411,6 +3417,8 @@ static int sip_hangup(struct ast_channel *ast)
                                        /* We can't send anything in CALLING state */
                                        ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
                                        /* Do we need a timer here if we don't hear from them at all? */
+                                       sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
+                                       append_history(p, "DELAY", "Not sending cancel, waiting for timeout");
                                } else {
                                        /* Send a new request: CANCEL */
                                        transmit_request(p, SIP_CANCEL, p->ocseq, XMIT_RELIABLE, FALSE);