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

Iñaki Baz Castillo ibc at aliax.net
Mon Feb 8 23:48:36 CET 2010


El Lunes, 8 de Febrero de 2010, Daniel-Constantin Mierla escribió:

> returnin 0 from a module function means 'exit':
> http://www.asipto.com/pub/kamailio-devel-guide/#c16return_values

Ok:

-------------
16.9.1. Return Values

Returning values from the command functions have a special meaning in the 
configuration file. The command functions return an integer value, and the 
config file interpreter use it as follows: 

 - 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 what about if I want to develop a module function which can return 0 as a 
valid integer and store it in a pv? (i.e. a function returning the number of 
locations for a given AoR).

 
> > It seems that allow_source_address_group() behaves as "return(0)" when
> > the returned value is 0. But this is not documented and IMHO it cannot be
> > the expected behavior, am I right?
> 
> You mean 'return 0' is not documented or this particular function's
> behavior with group id 0?

"return 0" is document (AFAIK) but I didn't expect that any function returning 
0 means "exiting".
Also, in the current module (permissions) and current function 
(allow_source_address_group) this is a limitation as it doesn't allow 
returning a group value 0.


Thanks.

-- 
Iñaki Baz Castillo <ibc at aliax.net>



More information about the sr-dev mailing list