"Does your service work with PJSIP?" I get this question once a week, at most. However, I am always astounded by the lack of knowledge brought to the table when I ask the logical question, "What is the use case for PJSIP?" Typically I get something along the lines of, "it's newer." Disregarding the fact that this is not a use case, it's also not a reason to utilize something. IPv6 is newer than IPv4, yet these same people are not retooling their networks to be fully run on IPv6. 

What is SIP?

 

I hate to start here, but sadly I am still asked to provide "SIP Trucks" every day, along with being told, "my SIP is broken." This leads me to believe I must first explain a little about SIP. SIP is a protocol. Which, I think is best related to proper grammar and etiquette. In grade school you were taught how to form a sentence, and from there a paragraph, and eventually you branched out until you could convey a thought/idea of any complexity via some language in written form.

You also learned that there are formal and informal ways of expressing written thought depending on your interpretation of what the situation called for, or perhaps based on stylistic choices which you made. The Session Initiation Protocol (SIP) is a formalized way to manage communication over the internet. Two devices operating within the limits of the rules governing SIP, should generally be able to communicate with each other. SIP has been reviewed by many engineers, far smarter than myself and likely far smarter than you, and it is far from broken. One person plugging in their SIP capable endpoint cannot break their SIP. Either the device manufacturer/developer has interpreted and implemented the RFCs for SIP correctly and your device will work with other SIP devices, or they have not. There is not much room for middle ground.

What is CHAN_SIP?

 

Chan_sip is a channel driver used for SIP functionality in Asterisk based devices (and likely others) for years. A channel driver is what allows your device/software to communicate via some protocol (SIP, IAX, Skinny, etc).  Chan_sip was developed when SIP was fairly new and prior to 2014 if you were communicating via SIP it is extremely likely that some device in that conversation was operating with chan_sip. 

It is the only SIP channel driver in Asterisk version 11 and lower. Starting in Asterisk version 12, you have access to chan_sip and chan_pjsip. Many people are still using chan_sip because it is well known, stable, time-tested, and supports all of the features they need for regular SIP communications. However, it is not easy to modify for new feature support, and is going to be surpassed by chan_pjsip in the future, in terms of number of devices using it, and number of developers extending it, customizing it, and reviewing it. 

What is CHAN_PJSIP?

 

PJSIP is a library which has become the foundation for the chan_pjsip channel driver in Asterisk version 12 and higher. You can use chan_pjsip by itself, or in parallel with chan_sip (if you know what you are doing). PJSIP is very modular and a change to one module does not affect the others. In other words, the developers of Asterisk (or any other communications platform using PJSIP) can add (or remove) features much more easily and have less risk of introducing a bug. 

Presently chan_pjsip is relatively new, yet an increasing number of Asterisk based systems are choosing chan_pjsip as the default SIP channel driver. Ultimately it doesn't require much adaptation from end-users on GUI based systems (FreePBX, Yeastar, Grandsteram, etc), but it does have a small learning curve for non GUI systems users (see this website for an overview and some examples). 

The current feature set for the PJSIP library can be found here

If you want to get more detailed information or even inspect the source code yourself you can visit www.pjsip.org

Parting Thoughts:

 

If you need some new SIP feature, or are using some newer module on your Asterisk server, you are likely going to choose chan_pjsip out of necessity. If you'd like to see what all the buzz is about, but are concerned for your safety; just remember, you cannot break SIP, and chan_pjsip should work for pretty much every use case where chan_sip already works. If you are just using SIP for VoIP and don't need anything beyond typical telephony features chan_sip should work for you for years to come.