[Kamailio-Devel] cfgutils api
Juha Heinanen
jh at tutpro.com
Tue Aug 26 16:19:01 CEST 2008
Elena-Ramona Modroiu writes:
> you can simply give NULL value as parameter.
ramona,
that worked fine. now i have in mod_init of shv_test module:
/* Shared variable test */
name.s = "$shv(enum_domains)";
name.len = strlen(name.s);
if (pv_parse_spec(&name, &spec) == NULL) {
LM_ERR("invalid shared variable specification\n");
return -1;
}
memset(&value, 0, sizeof(pv_value_t));
value.rs.s = "e164.arpa.";
value.rs.len = strlen(value.rs.s);
value.flags = PV_VAL_STR;
spec.setf(NULL, &spec.pvp, EQ_T, &value);
and shared variable $shv(enum_domains) gets correctly assigned value
"e164.arpa.", if and only if i have:
loadmodule "cfgutils.so"
loadmodule "shv_test.so"
...
modparam("cfgutils", "shvset", "enum_domains=s:foo")
that is, i create shared variable ""enum_domains" by cfgutils module.
however, if i don't define the above cfgutils shvset module parameter, i
get error message:
Aug 26 17:09:18 localhost /usr/sbin/kamailio[22934]: ERROR:core:pv_parse_spec: error searching pvar "shv"
Aug 26 17:09:18 localhost /usr/sbin/kamailio[22934]: ERROR:core:pv_parse_spec: wrong char [e/101] in [$shv(enum_domains)] at [5 (5)]
Aug 26 17:09:18 localhost /usr/sbin/kamailio[22934]: ERROR:shv_test:mod_init: invalid shared variable specification
Aug 26 17:09:18 localhost /usr/sbin/kamailio[22934]: ERROR:core:init_mod: failed to initialize module shv_test
my next question is, how can i create a new shared variable in shv_test
module without a need to do that by cfgutils module? i have searched
core/pvar.h, but have not found a pv create function.
-- juha
More information about the Devel
mailing list