[Kamailio-Devel] cfgutils api

Elena-Ramona Modroiu ramona at rosdev.ro
Tue Aug 26 09:22:20 CEST 2008


Hi Juha,

Juha Heinanen wrote:
> henning, elena,
>
> related to dynamic configuration of kamailio:
>
> would it be possible for cfgutils module to export pv_get_shvar and
> pv_set_shvar functions as its api for other modules to use?
>   
it is no need for that. You can get/set a shared variable via the PV 
engine API.

kind of:

str name;
pv_spec_t spec;
pv_value_t value;

name.s = "$shv(x)";
name.len = strlen(name.s);

pv_parse_spec(&name, &spec);

this part is usually at startup (mod init, fixup)

Then, at runtime, you can use the setf function from spec:

spec.setf(msg, &spec.pvp, EQ_T, &value);

you need to populate the value before.

As an example, get_user_group() from group module uses this approach.

In this way, all PVs that are writable can be set.

Regards,
Ramona

> -- juha
>
> _______________________________________________
> Devel mailing list
> Devel at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel
>   




More information about the Devel mailing list