[OpenSIPS-Devel] Share SIP Messages between 2 processes

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Jan 15 12:52:37 CET 2010


Olivier Détour wrote:
> On Thu, Jan 14, 2010 at 6:55 PM, Bogdan-Andrei Iancu
> <bogdan at voice-system.ro> wrote:
>   
>> Hi Olivier,
>>
>> Olivier Détour wrote:
>>     
>>> Hi,
>>>
>>> I'm writing a B2B module for the B2B_entities module (like B2B_logic).
>>> In my initialisation,
>>> I create an extra process to poll on an extra FD to receive order to
>>> create UAC part.
>>>
>>>       
>> Why don't you use the MI stuff for this? you can trigger an action /
>> event by sending an MI command to the server -> you module just has to
>> export a new MI function.
>>     
>>> I would like to know how to share a SIP message between the module and
>>> the extra process
>>> (I'm using OpenSIPs in fork mode ...) ? I tried to shm_malloc it but I
>>> get an out of memory error
>>> on the second Communication.
>>>
>>>       
>> normally using shm_malloc is the trick, but depends of where you fork
>> your process (if the shm is inherited) and who you use it for
>> transferring data from from A to B.
>>     
>
> Forks come from OpenSIPs itself (worker forks + my extra fork (extra
> process in module declaration)).
>   
OK, that's correct
> I think I have to use shared memory to share data between different
> processes. I tried to find the best and the most optimize way to use
> it.
>   
yes, you should use the sh mem. But what exactly do faile for you? I 
mean what exactly are you doing and what step fails? is the malloc not 
working? or ?
> Do you know actually, how much percent of the 32 MB of shared memory,
> is used by OpenSIPs ?
>   
Depends of what modules you are using - each module may have some 
internal data structures that are kept in shm mem.
You can check this via MI interface, after starting opensips (with no 
ongoing traffic) : "opensipsctl fifo get_statistics all"

Regards,
Bogdan

-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Devel mailing list