[pjsip] How to tweak PJ SIP to listen to more than one port at the same time?

Muthusamy, Balamurugan bmuthusa at qualcomm.com
Mon Aug 3 05:56:24 EDT 2009


There seems to be a small technical difficulty in the design of pjsip relating to your explain.

Benny mentions this in the post (http://osdir.com/ml/voip.pjsip/2007-07/msg00233.html):
"If you want each account to have its own UDP transport (you don't have to!), then you can create multiple UDP transports, and lock the account to a specific UDP transport with pjsua_acc_set_transport()."

So, I did just that and also used: pjsip_endpt_acquire_transport (as suggested by Klaus).  This causes the internal code to fail, since we have global static variables, which keeps overwriting the data of different threads.  The following scenario might help to understand a bit better:

In the first thread, if data is being sent out from port "A" (for client "A"), then we set the pjsip_endpt_acquire_transport to "A".
At the next instant, if I have another thread keep listening on pjsip_endpt_handle_events for port "B", then we have to set pjsip_endpt_acquire_transport to "B".

Unfortunately the ports eventually get over-written in the pjsip system, where both the threads start using the same internal end point.  So, even if I want to transmit using port "A", the first thread is now using port "B", since the pjsip_endpt_acquire_transport happened last for port "B".

Does this clarify the issue?
Bala



-----Original Message-----
From: pjsip-bounces at lists.pjsip.org [mailto:pjsip-bounces at lists.pjsip.org] On Behalf Of Klaus Darilion
Sent: Monday, August 03, 2009 1:43 AM
To: pjsip list
Cc: Gallardo, Gabriel
Subject: Re: [pjsip] How to tweak PJ SIP to listen to more than one port at the same time?

Create mutliple transports

regards
klaus

Muthusamy, Balamurugan schrieb:
> Can pjsip listen to more than one port at the same time?  I am writing a 
> load simulator, where I am simulating many clients, and each client has 
> its own SIP port on which it listens (and transmits) with the server.
> 
>  
> 
>  
> 
> This is better explained as below:
> 
>  
> 
> Even though we would have 1000s of clients, I would take an example with 
> 3 clients:
> 
> A: SIP Port: 8000
> 
> B: SIP Port: 8001
> 
> C: SIP Port 8002
> 
>  
> 
> Now, is there a way to make PJ SIP start sending AND receiving messages 
> from all these 3 different ports, at the same time?
> 
>  
> 
> I see that PJSIP can operate with only one port at any given time.  Even 
> if we use: pjsua_acc_set_transport and do an 
> pjsip_endpt_acquire_transport, it can still operate with only one port 
> at any given time.  So, there is not an easy way for me to make port 
> 8000 (User A) send an INVITE message at the same time while port 8001 
> (user B) receives an INVITE and port 8002 (user C) receives a BYE.
> 
>  
> 
> Bala
> 
>  
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




More information about the pjsip mailing list