[Asterisk-Dev] work-around for stuck SIP channels
Luca Spada
skyluke at ngi.it
Wed May 25 05:01:57 MST 2005
Hi there,
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 at 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.
Thank you for asterisk ;)
bye
Luca "skyluke" Spada - luca.spada at ngi.it - Fondatore e Amministratore Delegato
--
NGI SpA - Via Darwin, 85 Phone: 02370085.1 Fax: 02335170605
20019 Settimo Milanese Italy http://www.ngi.it
--
NGI SpA è una Società del Gruppo I.NET SpA
More information about the asterisk-dev
mailing list