[sr-dev] [permissions module] allow_source_address_group() drops the request if it returns 0

Daniel-Constantin Mierla miconda at gmail.com
Mon Feb 8 23:40:28 CET 2010


Hello,

On 2/8/10 11:01 PM, Juha Heinanen wrote:
> Iñaki Baz Castillo writes:
>
>   >  I do "$avp(i:10) = allow_source_address_group()" for a request whose source
>   >  address matches a row in "address" table with "grp=0". I expect that
>   >  allow_source_address_group() would return 0.
>
> i checked the code and it returns the number of the group.
maybe a pseudo-variable fits better for this purpose.

Return codes for module functions group in three classes:
 >0 - true
==0 - exit
<0 - false

They are not very indicated to be used for returning values in the 
script, although, of course, you need different true/false values to 
distinguish among various internal behaviors of the function.

Cheers,
Daniel
>    if group
> happens to be zero, it returns zero, which exists the script.  i need to
> disallow group number 0 and document it.
>
> so the "fix" is to use some other group number that zero.
>
>    

-- 
Daniel-Constantin Mierla
eLearning class for Kamailio 3.0.0
* http://www.asipto.com/




More information about the sr-dev mailing list