[sr-dev] troubles configuring acc.so without db_url

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 12 10:43:21 CEST 2011


Hi Francesco,

indeed there was a conflict in not setting the database url and using 
flag 0 in the configuration file -- as you noticed, the db flags were 
reset to 0 in that case.

I just committed a patch (bot master and 3.1 branches) to set db_url to 
null if empty string is provided as parameter value and keep the db 
flags to -1, which means the db accounting is disabled.

See more comments inline.

On 4/11/11 1:58 PM, Francesco Castellano wrote:
> Hi all,
>
> I was trying to use Kamailio 3.1.3 with acc module, but without DB
> backend (syslog only).  Unfortunately kamailio segfaulted after
> receiving a NATed REGISTER (flagged in my script with the first pos
> "0"). If I understood correctly, the trouble lies with some
> misbehaviour with the acc parameters initializations, namely, even if
> I remove the modparam with db_url, and set db_flag and db_missed_flag
> to -1, the mod_init() function in modules_k/acc/acc_mod.c, reset the
> flags to "0", because in its opinion db_url.s was not NULL.
>
> Unfortunately I'm not confident with the config file parsing through
> yacc, so I'm not sure where the problem actually is.
>
> So, I tried a workaround specifying a "null" db_url (as I supposed to
> be the default, reading the docs; and actually the value I found in
> modules_k/acc/acc_mod.c):
>
> modparam("acc", "db_url", 0)
>
> or
>
> modparam("acc", "db_url", "")
>
> or
>
> modparam("acc", "db_url", "NULL")
>
> but, understandably, they don't work. Is there a way to specify a null
> value for a modparam in the config file?
no, it is not possible to specify null value for a module parameter in 
the config file. If parameter's default value is null, to keep it so, 
then just don't set any value to it.

> In the meanwhile I set the db_url to a valid value, created a valid
> table `acc`, and used a flag that I never use in my script, but I know
> it could be done better.
>
> For example, maybe mod_init can reset db_flag and db_missed_flag to an
> invalid value (-1?) when it find NULL the db_url variable (using a
> valid flag, as 0, may lead to unexpected behaviour; or I've not got
> what a valid flag is? In this case, I'm sorry).
>
> Secondarily mod_init could check for the zero-length too, supposing
> that no valid db_url can be zero-length.
These were done in the patch, thanks for troubleshooting.
> Finally, and more importantly, do you have any idea about the reason
> for which the config parser can see a default value for db_url (for
> acc), different from the one in modules_k/acc/acc_mod.c (specifically,
> it takes a valid db_url used by other modules)?

What operating system are you using? Normally should not be a symbol 
conflict and the value of the db url in acc module should be the one set 
locally - so far it was not reported any such conflict although the acc 
module is very old.

Cheers,
Daniel
> Thank you,
> Best regards,
> Francesco Castellano
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the sr-dev mailing list