[OpenSER-Users] is_uri_host_local() returns 1 or 4294967295 (always TRUE !!!)

Iñaki Baz Castillo ibc at in.ilimit.es
Mon Sep 3 13:01:10 CEST 2007


El Monday 03 September 2007 12:55:34 Daniel-Constantin Mierla escribió:
> Hello,
>
> On 09/03/07 13:36, Iñaki Baz Castillo wrote:
> > Hi, in order to minimize the SQL queries for functions
> > "is_uri_host_local()" and "is_from_local()" I want to exec they just one
> > time and store the result in a variable, but the result is unexpected:
> >
> >   $var(is_uri_host_local) = is_uri_host_local();
> >   xlog("------------is_uri_host_local = $var(is_uri_host_local)\n");
>
> a better way to do it is:
>
> is_uri_host_local();
> $var(is_uri_host_local) = $retcode;
>
> Some times, because of OpenSER return code schema, negative values are
> converted to -1, positive to 1 (0 is used to signal an exit from config
> script interpretation). In this case might work, but not in all. The
> 4294967295 is actually the unsigned int of -1 (or similar). The printing
> function should be changed to use signed int to have it clear and
> correct here.
>
> However, with the above code I gave, you can do:
>
> if ($var(is_uri_host_local)<0) to check if was a false response or:
> if ($var(is_uri_host_local)>0) to check if was a true response.


Thanks for the explanation. ;)



-- 
Iñaki Baz Castillo
ibc at in.ilimit.es




More information about the Users mailing list