Re: [OpenSIPS-Devel] Share SIP Messages between 2 processes

2010-01-15 Thread Bogdan-Andrei Iancu
Olivier Détour wrote:
 On Thu, Jan 14, 2010 at 6:55 PM, Bogdan-Andrei Iancu
 bog...@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


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] Share SIP Messages between 2 processes

2010-01-15 Thread Olivier Détour
On Fri, Jan 15, 2010 at 12:52 PM, Bogdan-Andrei Iancu
bog...@voice-system.ro wrote:
 Olivier Détour wrote:
 On Thu, Jan 14, 2010 at 6:55 PM, Bogdan-Andrei Iancu
 bog...@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 ?

When I use B2B, I have to forward my INVITE in another process, that
is why I have to copy it (body, URIs, ...) in my shm_malloced internal
data structure. It works, but I find it ugly.
Moreover, sometimes I get an internal error because I don't have
enough shared memory,
that's why I want to find a better way.

I'm blocked by OpenSIPs' architecture.

If this is the only way, I could optimize it on my side.

 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


Thanks for the tips, it will be helpful to debugging.

 Regards,
 Bogdan


Regards,

-- 
Olivier Détour

___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] Share SIP Messages between 2 processes

2010-01-14 Thread Bogdan-Andrei Iancu
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.

Regards,
Bogdan
 Thanks for your response,

 Regards,

 --
 Olivier Détour



   


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


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel