On 20.07.2009 17:12 Uhr, Klaus Darilion wrote:
that's strange:
santity module defines the return values:
#define SANITY_CHECK_PASSED 1 -> good message #define SANITY_CHECK_FAILED 0 -> bad message #define SANITY_CHECK_ERROR -1 -> error during check (eg. out of mem)
Further, openser module function return values result in: http://www.asipto.com/pub/openser-devel-guide/#c16return_values
if <0 - evaluation of the return code is FALSE if 0 - the interpreter stop executing the configuration file if >0 - evaluation of the return code is TRUE
So, if there is a bad message, script execution should be stopped.
that warning message: Jul 20 13:34:06 [8226] WARNING:sanity:check_ruri_scheme: failed to parse request uri
is printed but no error returned. A field in the uri structure is checked later. The problem was with return code from internal parse uri function, which in K is 0 for success but was checking for 1. The error field in structure was not set because parsing went actually ok. It was something harmless, just warn printed out.
Cheers, Daniel
Strange
klaus
Dubravko Caric schrieb:
Hi all,
I have a question regarding sanity module (kamailio 1.5.1). Module documentation says "The function returns true if one of the checks failed", but as you can see in case 1 (request is valid) and case 2 (request is not valid because bad request uri) requests always enter function block.
Does anybody else have the same problem? Any help would be appreciated... Thanks a lot
/dubravko
*Case 1:* if (is_method("REGISTER")) { xlog("L_INFO", "ENTER REGISTER\n"); if (sanity_check("128","6")) { xlog("L_NOTICE", "SANITY $si:$sp TIME $Tf USER $fu METHOD $rm\n"); exit; } }
ENTER REGISTER Jul 20 13:30:13 [8180] DBG:core:parse_headers: flags=2000 Jul 20 13:30:13 [8180] DBG:core:get_hdr_field: cseq <CSeq>: <1>
<REGISTER> Jul 20 13:30:13 [8180] DBG:core:get_hdr_field: content_length=0 Jul 20 13:30:13 [8180] DBG:core:parse_headers: flags=ffffffffffffffff Jul 20 13:30:13 [8180] DBG:core:get_hdr_field: found end of header Jul 20 13:30:13 [8180] DBG:sanity:sanity_check: all sanity checks passed SANITY xxx.xxx.xxx.xxx:22355 TIME Mon Jul 20 13:30:13 2009 USER sip:bob@exmaple.com METHOD REGISTER Jul 20 13:30:13 [8180] DBG:core:destroy_avp_list: destroying list (nil) Jul 20 13:30:13 [8180] DBG:core:receive_msg: cleaning up
*Case 2:* ... if (sanity_check("130","6")) { ...
ENTER REGISTER Jul 20 13:34:06 [8226] WARNING:sanity:check_ruri_scheme: failed to parse request uri Jul 20 13:34:06 [8226] DBG:core:parse_headers: flags=2000 Jul 20 13:34:06 [8226] DBG:core:get_hdr_field: cseq <CSeq>: <1>
<REGISTER> Jul 20 13:34:06 [8226] DBG:core:get_hdr_field: content_length=0 Jul 20 13:34:06 [8226] DBG:core:parse_headers: flags=ffffffffffffffff Jul 20 13:34:06 [8226] DBG:core:get_hdr_field: found end of header Jul 20 13:34:06 [8226] SANITY xxx.xxx.xxx.xxx:22359 TIME Mon Jul 20 13:34:06 2009 USER sip:bob@exmaple.com METHOD REGISTER Jul 20 13:34:06 [8226] DBG:core:destroy_avp_list: destroying list (nil) Jul 20 13:34:06 [8226] DBG:core:receive_msg: cleaning up
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users