[asterisk-bugs] [Asterisk 0016224]: Thousands of Invites never discarded in sip channels

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Dec 2 14:43:02 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16224 
====================================================================== 
Reported By:                falves11
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16224
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           SVN 
JIRA:                       SWP-400 
Regression:                 Yes 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!): 229360 
Request Review:              
====================================================================== 
Date Submitted:             2009-11-11 14:27 CST
Last Modified:              2009-12-02 14:43 CST
====================================================================== 
Summary:                    Thousands of Invites never discarded in sip channels
Description: 
The scenario is very simple
We receive an INVITE
we respond Hangup(34)

after a few hours, if you type "ship show channels" you get thousand of
those failed invites, all identica, llike this:
208.X.X.X   7134239089  65745230093  00102/00000  0x0 (nothing)    No     
 Init: INVITE              
208.X.X.X   8633996336  41250481070  00102/00000  0x0 (nothing)    No     
 Init: INVITE              
208.X.X.X   4046670409  0403812114e  00102/00000  0x0 (nothing)    No     
 Init: INVITE              
208.X.X.X   7134239089  06060dc345a  00102/00000  0x0 (nothing)    No     
 Init: INVITE 
====================================================================== 

---------------------------------------------------------------------- 
 (0114564) ili4 (reporter) - 2009-12-02 14:43
 https://issues.asterisk.org/view.php?id=16224#c114564 
---------------------------------------------------------------------- 
Hi.

I have same problem on version 1.6.1.6, 1.6.2 and latest trunk. When
asterisk does not revieve any reply from remode side on SIP dial (ex:
dialing non existing host), sip channel becomes "frozen". This channels
cleared only after asterisk restarts.

In sip.conf RTP timers and SIP Session-Timers are enabled.

In debug log I saw messages "Re-scheduled destruction of SIP call
<call-id>". Messages with same call-id repeat every 30 seconds. So I think
"Re-scheduled destruction of SIP call" mechanism does not work.

I fixed this by modifying chan_sip.c. Code in function
__sip_autodestruct:
--------------
        if (p->packets) {
                if (!p->needdestroy) {
                        char method_str[31];
                        ast_debug(3, "Re-scheduled destruction of SIP call
%s\n", p->callid ? p->callid : "<unknown>");
                        append_history(p, "ReliableXmit", "timeout");
                        if (sscanf(p->lastmsg, "Tx: %30s", method_str) ==
1 || sscanf(p->lastmsg, "Rx: %30s", method_str) == 1) {
                                if (method_match(SIP_CANCEL, method_str)
|| method_match(SIP_BYE, method_str)) {
                                        p->needdestroy = 1;
                                }
                        }
                        return 10000;
                } else {
                        /* They've had their chance to respond. Time to
bail */
                        __sip_pretend_ack(p);
                }
        }
----------------
I changed to:
----------------
        if (p->packets) {
                if (!p->needdestroy) {
                        ast_debug(3, "Re-scheduled destruction of SIP call
%s\n", p->callid ? p->callid : "<unknown>");
                        append_history(p, "ReliableXmit", "timeout");
                        p->needdestroy = 1;
                        return 10000;
                } else {
                        /* They've had their chance to respond. Time to
bail */
                        __sip_pretend_ack(p);
                }
        }
-------------
So I removed check for SIP_CANCEL method from "Re-scheduled destruction of
SIP call" mechanism. And now all frozen channels cleared in few minutes.

I've uploaded patch named asterisk-rescheduled-destruction.patch. Please,
try it, and report, how its works. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-12-02 14:43 ili4           Note Added: 0114564                          
======================================================================




More information about the asterisk-bugs mailing list