[OpenSIPS-Users] Typo in message header and how to catch it

Cindy Leung cinthia721 at gmail.com
Mon Mar 25 22:06:59 CET 2013


Hi Razvan,

This is a part of the config that's supposed to catch parse errors:

error_route{
	xlog ("Entering error route");

        # SIP message parse error        
        if ( $(err.class)==1 ) {
                xlog ("Parse error from $si:$sp");
                xlog ("$mb");
                sl_send_reply("$err.rcode", "$err.rreason");
                exit;
        }

        else {
                xlog ("Error class=$(err.class) level=$(err.level) info=$(err.info)");
        }
}

route{
        if ( !sipmsg_validate() ) {
                xlog ("Bad request from $si:$sp");
                xlog ("$mb");
                sl_send_reply("400", "Bad Request");
                exit;
        }
...

I'm sure it didn't go through error route for TCP because none of the xlog messages showed up in syslog.
I've also tried "s", "sh", and nothing as flags for sipmsg_validate.  Same error every time.

Thanks.


Cindy


On Mar 25, 2013, at 1:26 PM, Răzvan Crainea wrote:

> Hi Cindy!
> 
> for TCP: the error seems to occur while reading the message. Are you sure the error route is not called for this type?
> for UDP: Are you passing any flags to the sipmsg_validate() function? Have you tried using the 's' flag [1]?
> 
> [1] http://www.opensips.org/html/docs/modules/1.9.x/sipmsgops.html#id293070
> 
> Best regards,
> Razvan Crainea
> OpenSIPS Core Developer
> http://www.opensips-solutions.com
> On 03/22/2013 02:30 AM, Cindy Leung wrote:
>> Hi all,
>> 
>> So we encountered a malformed SIP message one day that looks like this...
>> 
>> INVITE sip:2345 at my.opensips.server.IP:5060 SIP/2.0
>> Via: SIP/2.0/UDP 127.0.1.1:5060;branch=z9hG4bK-15598-12-0
>> From: sipp <sip:1234 at 127.0.1.1>;tag=12
>> To: <sip:2345 at my.opensips.server.IP:5060>
>> Call-ID: 12-15598 at 127.0.1.1
>> CSeq: 1 INVITE
>> Contact: "1234" <sip:1234 at 127.0.1.1:5060;transport=udp>
>> User-Agent: SIPp
>> Max-Forwards: 70
>> Content-Type: application/sdp
>> Content-Lenght: 0
>> 
>> Typo in Content-Length.
>> 
>> This message successfully passed through error_route and sipmsg_validate() and continue through the rest of the config.  Interesting enough, I get different errors when I send it over different protocol.
>> 
>> TCP:
>> /usr/local/sbin/opensips[18814]: ERROR:core:tcp_read_req: bad request, state=4, error=4 buf: <SIP message here>
>> 
>> UDP:
>> /usr/local/sbin/opensips[18804]: ERROR:core:clen_builder: no message body found (missing crlf?)
>> /usr/local/sbin/opensips[18804]: ERROR:core:build_req_buf_from_sip_req: failed to adjust Content-Length
>> /usr/local/sbin/opensips[18804]: ERROR:tm:print_uac_request: no more shm_mem
>> /usr/local/sbin/opensips[18804]: ERROR:tm:t_forward_nonack: failure to add branches
>> 
>> Can you let me know if I have missed anything please?  Thanks!
>> 
>> 
>> Cindy
>> 
>> 
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130325/efc022f9/attachment.htm>


More information about the Users mailing list