On 1/25/08, Net Dabbler <netdabbler at gmail.com> wrote: > Hi all, > I'm a new user of PJSIP and so far I've looked through the code to try to > get a feel for it. I've also tried the demo applications (on Linux PCs) > including pjsua. I would like to set up PJSIP to use SCTP instead of TCP or > UDP. I plan to use the SCTP implementation from the University of Essen ( > http://www.sctp.de/sctp-download.html), which provides SCTP > and socket libraries. > That's cool! I have no clue whatsoever about this library (and obviously too ignorant to read the docs), so is this a userland library? Does it have it's own API, or will it integrate into native OS socket API? > I thought transport and socket code would be in one place but it appears in > the PJLIB, PJSIP and PJMEDIA libraries. I'm thinking I should start with > the socket handling code in PJLIB if I want to call the SCTP libraries. Is > this the best place to approach the task? All comments appreciated. > Your observation is correct. The socket abstraction in PJLIB is necessary to have a portable socket API across platforms, while the transport code in PJSIP and PJMEDIA should be platform independent. Further in PJLIB, there are few socket abstractions. The lowest layer is BSD API abstraction (pj/sock.h), then there is select() API abstraction (pj/sock_select.h), and finally asynchronous I/O abstraction (pj/ioqueue.h). The ioqueue may or may not use the select() abstraction (for example, it uses IoCompletionPort on WinNT). You can even develop an ioqueue that doesn't need socket stack (for example, works directly on top of hardware and runs in the context of interrupt). The current transports in PJSIP and PJMEDIA uses the ioqueue abstraction, since it needs non-blocking I/O. So here the transports are platform independent, just like the rest of PJSIP and PJMEDIA. For SCTP implementation, I suggest you start by creating the SCTP SIP and media transport, in PJSIP/PJMEDIA. You don't need to use PJLIB socket abstraction or ioqueue if you don't want to, and in fact, for initial implementation, I would suggest to use the SCTP API directly to make it simpler to implement. You may use worker thread in your transport if that makes the implementation simpler. Once you're done and everything runs okay, we can move forward to optimize it, removing worker thread if present, and perhaps making it more integrated with the rest of the libraries, somehow. But for the start, I suggest we focus on adding the SCTP functionality in PJSIP/PJMEDIA first. cheers, -benny