Hello,

On 12/12/11 11:15 AM, Morten Isaksen wrote:
I had a similar problem with avp_db_query

if (avp_db_query(...) == -2) {
   xlog("...");
}

did not work, but

$var(r) = avp_db_query(....);
if ($var(r) == -2) {
   xlog("...");
}

did work.
indeed, this is a solution. As stated in the previous email, inside an IF expression, the return code from functions exported to config are converted to 0 if return code is < 0 and to 1 if the return code is >0 to match in C the special meaning of return codes in the config file.

Cheers,
Daniel



/Morten


On Sat, Dec 10, 2011 at 3:16 PM, Juha Heinanen<j...@tutpro.com>  wrote:
i have defined two routes:

route [TEST_ROUTE_MINUS_ONE] {
      return (-1);
}

route [TEST_ROUTE_PLUS_ONE] {
      return (1);
}

and then test them with these statements:

    if (route(TEST_ROUTE_MINUS_ONE) == -1) {
        xlog("L_INFO", "TEST_ROUTE returned -1\n");
    }

    if (!route(TEST_ROUTE_MINUS_ONE)) {
        xlog("L_INFO", "TEST_ROUTE returned failure\n");
    }

    if (route(TEST_ROUTE_PLUS_ONE) == 1) {
        xlog("L_INFO", "TEST_ROUTE returned 1\n");
    }

    if (route(TEST_ROUTE_PLUS_ONE)) {
        xlog("L_INFO", "TEST_ROUTE returned success\n");
    }

can someone explain, why i get only three lines to syslog?

Dec 10 16:14:56 sip /usr/sbin/sip-proxy[16099]: INFO: TEST_ROUTE_MINUS_ONE 
returned failure
Dec 10 16:14:56 sip /usr/sbin/sip-proxy[16099]: INFO: TEST_ROUTE_PLUS_ONE 
returned 1
Dec 10 16:14:56 sip /usr/sbin/sip-proxy[16099]: INFO: TEST_ROUTE_PLUS_ONE 
returned success

-- juha

_______________________________________________
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://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda


_______________________________________________
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

Reply via email to