[sr-dev] fork process in kamailio

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Sep 9 22:25:54 CEST 2010


On Sep 04, 2010 at 19:49, Stefano Poli <stefano.poli87 at gmail.com> wrote:
> Hi,
> I have to modify kamailio to add QoS to presence module. I have to fork a
> new process that is allowed to access presentity table into database but
> with the classik fork() function i cannot access to it. Have I to do
> something in particular?
> Thanks!


The proper way to fork a process that can access internal structures or
send packets, in kamailio >= 3.0, ser >= 2.0 or any sip_router version
is using fork_process() from mod_child, when rank == PROC_MAIN.
You should also register the number of processes you intend to fork,
from mod_init using register_procs(no).

For more info and an example see doc/modules_init.txt
(http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob_plain;f=doc/modules_init.txt;hb=HEAD),
in particular the "Forking new SIP-router processes from a module"
example.


Andrei



More information about the sr-dev mailing list