Hello,

yes, the return codes are interpreted in a special way, see:

- http://www.kamailio.org/wiki/cookbooks/devel/core#return

Same applies for the functions exported by the modules.

Cheers,
Daniel

On 11/02/16 13:41, Phil Lavin wrote:

Hi all,

 

Just a sanity check, really. Does Kamailio consider negative response codes to be false? For example, should the following log execute?

 

if (!foo()) { # Returns -2

     x_log(“Foo is false”);

}

 

The reason for asking here is that I’m implementing flood protection using pike, based off the kamailio.cfg that ships with v4.3. The logic is thus:

 

if (!pike_check_req()) {

    # Do blocking

}

 

However pike_check_req only returns -1 or -2 in the case of failure, never 0. The blocking code is, thus, never executed. Changing to explicitly check for != 1 works correctly.

 

Am I missing something here or is the example kamailio.cfg incorrect?

 

 

Cheers



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
http://miconda.eu