[pjsip] Implementing your own PJSIP_Transport and threading

scamper 22 scamper_22 at hotmail.com
Thu Dec 5 15:38:37 EST 2013

Hi all,

I'm wondering how easy it is to replace the networking/threading aspect of PJSIP?  I've been reading the documentation (PJSIP-Dev-Guide) and it looks like it might be possible, but I'm lost in how to approach it. I'm working pretty high-level here just seeing if PJSIP can be made to work.

Our basic application: 
Will use TURN with ICE to communicate to a SIP Server (Register, INVITE, data traffic) and will have hundreds/thousands of connections to the sip server.

Here's the issue.  We have an application which abstracts its own networking classes. We'd like to use PJSIP, while still using the same networking classes. I'm not sure if it is relevant, but the reasoning behind this is due to the network library behind highly tuned for performance as well as tracking connections for statistics.

So basically, I'm imagining writing an adapter which would contain functions like
connect, read, write, notify_new_data, notify_closed... basically an asynchronous socket interface, so all networking calls made by pjsip use our socket interface. It looks like this is possible by creating our own pjsip_transport.

Does anyone have a good skeleton or sample code for this?

The second aspect has to do with threading. If I read it correctly, PJSIP will maintain it's own timers and event queues. It is up to the application to call handle_events. I could use some clarity here. Is there only one EndPoint and thus one IOQ, and thus one handle_events that needs to be called globally. Or are there normally multiple end points?

For example. Suppose on the same application, I register 2 sip users (user1 and user2). They each have their own underlying TCP connection to the SIP server. Will both their events comes through a single endpoint?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20131205/cef6f3bd/attachment-0001.html>

More information about the pjsip mailing list