In this blog article we will discuss the basic standards used for real-time communications — SIP and XMPP — what is the difference, how each of them works, and, which one to choose.
SIP and XMPP
The IETF has two documented standards for real-time communications that are widely implemented: SIP and XMPP.
These standards transport text information and rely on other standards for the actual media transmission.
As both support real-time communications, many question which solution is most suited to their needs.
Let’s briefly explore the history and purpose of both.
SIP and XMPP: History
XMPP (Extensible Messaging and Presence Protocol) was previously known as Jabber. Jabber Inc. was the name of a company involved in the development of the original protocol. XMPP was chosen because of its neutrality, which makes sense because Cisco bought Jabber Inc., and acquired the related trademark.
XMPP is the protocol behind services like Whatsapp (which uses an XMPP variant optimized to consume less bandwidth), Google Talk (now Hangouts uses a proprietary protocol) and Facebook Messenger. XMPP has become very prominent as a system for federated IM. Many companies have deployed it for this purpose without necessarily using it for voice and video. XMPP was started as a chat and presence conference protocol, but was later enriched with protocols like Jingle to add audio, video calls and support for other medias like file sharing.
The Session Initiation Protocol (SIP) is a communications protocol for signaling and controlling multimedia communication sessions. The most common applications of SIP are in Internet telephony for voice and video calls, as well as instant messaging, over Internet Protocol (IP) networks.
SIP has, in fact, became the de facto VoIP signaling standard in place of MGCP (it refers to Media Gateway Control Protocol and allows a “Call Agent” to interface with media gateways, which effectively allows a PSTN gateway to be broken down into a control function (the Call Agent) and more media functions (the Media Gateways) and H.323 (it was created by the ITU-T and was primarily focused on video conferencing). It is now supported or used by most PBXs and VoIP Operators worldwide.
Just as a significant number of voice-related products and services use SIP, there is also a significant quantity of high-quality IM client software and third-party frameworks for interaction with XMPP, which has helped it remain dominant in the IM domain.
Over time, both SIP and XMPP have developed and can perform similar operations. SIP can make phone calls, initiate video calls, and launch instant messaging (IM) sessions. XMPP can also perform these same tasks. However, there has been a tendency to use SIP more for voice and use XMPP more for IM.
How SIP and XMPP work?
SIP and XMPP each work in different ways. SIP will run over UDP, TCP, TLS, WebSockets, and SCTP, while XMPP usually runs over TCP, WebSockets, and HTTP Bosh. SIP is a text-based request-response protocol, while XMPP is XML-based client-server architecture. In other words, clients do not talk directly to one another. SIP signaling messages contain an SIP header and body, while XMPP sends its request, response, and error messages using XML via a streaming connection.
Usage and Differences
SIP is the protocol used by VoIP operators (for example, companies offering trunking to or from the PSTN) and manufacturers of VoIP hardware, such as ISDN or analog media gateways and VoIP phones. This is because it supports a set of features required by telephony applications such as:
- Transfers, Forwards
- Caller-ID updates
- Pick-ups
- Phone user presence
- Fax sessions
This is very important because a communication system must substitute an existing PBX in its entirety. XMPP, with its Jingle extension, cannot be used to substitute an existing PBX because it is lacking all of these features.
XMPP is the protocol used for point-to-point and conference chat sessions, but it lacks easy interconnection with existing VoIP networks and support for telephony features. XMPP as an Instant Messaging protocol is much more developed than SIP, especially when used as an IM protocol together with multimedia. It supports many additional standards like:
- Message delivery notification
- Conferencing
- Rosters management
- Last activity
There are hundreds of extensions to XMPP called XEP (XMPP Extension Protocol), which increase the features of XMPP. In addition, SIP is growing fast in this regard. In the next few years, the situation could change, with SIP becoming a full-fledged alternative to XMPP.
Conclusion
So the question is, which one should be used? The answer is that both have advantages and disadvantages. SIP is ideal for implementing a full-featured telephone system with multimedia capabilities. IM capabilities are not as advanced as in XMPP. XMPP is ideal for implementing a full IM platform and, via extensions like Jingle, allows you to initiate calls and other media sessions. However, telephony features, such as transfer, are missing.
Information request: