[Home]

Summary:ASTERISK-04272: stuck SIP channels
Reporter:skyluke (skyluke)Labels:
Date Opened:2005-05-25 08:51:05Date Closed:2005-07-05 22:30:22
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Registration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) register.tcpdump
Description:I was suffering the following problem with stuck SIP channels (it happends with asterisk 1.0.7 and the lastest CVS-HEAD-05/24/05-20:44:59):

sip show channels
82.48.126.223    (None)      2eb141f241b  00101/00000   unknow
82.48.126.223    (None)      1f16e9e8119  00101/00000   unknow
82.48.126.223    (None)      2eb141f241b  00101/00000   unknow
82.48.126.223    (None)      1f16e9e8119  00101/00000   unknow
82.48.126.223    (None)      2eb141f241b  00101/00000   unknow
82.48.126.223    (None)      1f16e9e8119  00101/00000   unknow
82.48.126.223    (None)      2eb141f241b  00101/00000   unknow
82.48.126.223    (None)      1f16e9e8119  00101/00000   unknow
82.48.126.223    (None)      2eb141f241b  00101/00000   unknow
82.48.126.223    (None)      1f16e9e8119  00101/00000   unknow
82.48.126.223    (None)      2eb141f241b  00101/00000   unknow
82.48.126.223    (None)      1f16e9e8119  00101/00000   unknow
... lots of them

and after some hours asterisk crashed for "too many open files".

I did some debugging and discovered that the offendind IP was sending malformed "Call-ID:" header:

[...]
Call-ID: 2eb141f241b71efb79e2a9e37545e146@82.48.126.223eq: 857 REGISTER [...]

It seems like it joined "Call-ID:" and "CSeq:" in one string, eating 3 chars. The funny thing is that this malformed Call-ID are coming from another asterisk. I'm making some investigations to discover what version of asterisk the user is using.

Asterisk doesn't seem to process righ this kind of "Call-ID" strings causing the above problem.

I made the following patch in order to skip this kind of malformed Call-ID.

chan_sip.c:

search for "sip_pvt *find_call", before:

       if (ast_strlen_zero(callid)) {
               ast_log(LOG_WARNING, "Call missing call ID from '%s'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr));
               return NULL;
       }

add:

       if (strchr(callid,' ')) {
               ast_log(LOG_WARNING, "Malformed call ID '%s' from '%s'\n", callid, ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr ));
               return NULL;
       }

Mark:

I think you should better check "callid" in "create_addr" before tokening it into sip_peer.fromdomain.
Comments:By: Michael Jerris (mikej) 2005-05-25 08:56:30

Can you please also provide information about the version of the box sending the malformed sip packets and sip debug information from each side.  There may be more issues lurking here.



By: Matthew Simpson (matthewsimpson) 2005-05-25 13:21:40

I see this as well on my boxes, both stable 1.0.6 version and CVS head.

By: Mark Spencer (markster) 2005-05-25 13:51:45

Can you turn on sip history so we can see where the *real* failure is.  Thanks.

By: skyluke (skyluke) 2005-05-25 17:45:28

Turned history on:

sip show channels:
81.174.21.162    (None)      79e2a9e3754  00101/00000   unknow
81.174.21.162    (None)      79e2a9e3754  00101/00000   unknow
81.174.21.162    (None)      79e2a9e3754  00101/00000   unknow
81.174.21.162    (None)      79e2a9e3754  00101/00000   unknow
81.174.21.162    (None)      79e2a9e3754  00101/00000   unknow

sip show history
79e2a9e37545e146515f007c5bd062c2@81.174.21.162: 841 REGISTER  
79e2a9e37545e146515f007c5bd062c2@81.174.21.162: 840 REGISTER  79e2a9e37545e146515f007c5bd062c2@81.174.21.162: 839 REGISTER  
79e2a9e37545e146515f007c5bd062c2@81.174.21.162: 838 REGISTER  79e2a9e37545e146515f007c5bd062c2@81.174.21.162: 837 REGISTER  

*CLI> sip show history 79e2a9e37545e146515f007c5bd062c2@81.174.21.162

 * SIP Call
1. Rx              REGISTER /
2. Rx              REGISTER /
3. Rx              REGISTER /
4. Rx              REGISTER /
5. Rx              REGISTER /
6. Rx              REGISTER /

 * SIP Call
1. Rx              REGISTER /
2. Rx              REGISTER /
3. Rx              REGISTER /
4. Rx              REGISTER /
5. Rx              REGISTER /
6. Rx              REGISTER /

 * SIP Call
1. Rx              REGISTER /
2. Rx              REGISTER /
3. Rx              REGISTER /
4. Rx              REGISTER /
5. Rx              REGISTER /
6. Rx              REGISTER /

 * SIP Call
1. Rx              REGISTER /
2. Rx              REGISTER /
3. Rx              REGISTER /
4. Rx              REGISTER /
5. Rx              REGISTER /
6. Rx              REGISTER /

 * SIP Call
1. Rx              REGISTER /
2. Rx              REGISTER /
3. Rx              REGISTER /
4. Rx              REGISTER /
5. Rx              REGISTER /
6. Rx              REGISTER /
7. Rx              REGISTER /

hope this helps.

I'm still waiting for the version of the remote asterisk

By: Clod Patry (junky) 2005-05-25 19:44:51

Please attach a patch (diff -u format).
Thanks.

By: Michael Jerris (mikej) 2005-05-25 20:16:58

am I missing somthing or is checking for a space not a solution to a callid that is too long... I think we really need to see debugs on this to determin exactly how the callid is malformed and get a beter idea of what checks we should have..

By: Olle Johansson (oej) 2005-05-26 02:25:29

I do not think the call id is the problem, is that we are missing cseq... The Call ID is just a unique string that you don't parse. Can we please get a full DEBUG packet of this register packet?

By: skyluke (skyluke) 2005-05-26 03:01:27

I have uploaded a tcpdump of the broken registations.

By: Michael Jerris (mikej) 2005-05-26 06:49:50

4th request for asterisk debug of this.  (Both sides please)

By: Olle Johansson (oej) 2005-05-26 15:30:42

A tcpdump is fine, but we really need a SIP debug output from asterisk that will also show us what is happening inside your asterisk. TCPdump does not show that. Set verbose to 4, set debug to 4 and turn on SIP DEBUG. Pipe to a file and upload that file.

By: Olle Johansson (oej) 2005-06-04 07:08:48

Please try with latest CVS head as we changed the registration code tonight.

By: skyluke (skyluke) 2005-06-05 10:52:45

Installed.

Have to wait till tomorrow to replicate the bug with the customer. thanks

By: Michael Jerris (mikej) 2005-06-19 09:06:34

skyluke- We need an update on this to move forward.

By: Kevin P. Fleming (kpfleming) 2005-07-05 22:30:12

It's been a month since we got an update; if this is still an issue please open a new bug with a complete debug trace.