VoIP Resources VoIP Fundamentals Developer Blog

Combining SIP and XMPP

by OnSIP

Explanation of SIP & XMPP and how to use them both.

Today, both SIP and XMPP are widely deployed technologies for real-time communication over the Internet. Like SIP, Extensible Messaging and Presence Protocol or XMPP is also an application layer protocol designed for sending and receiving messages over IP. Originally called Jabber, XMPP was developed by the Jabber open source community in 1999 for instant messaging and presence.

There are similarities between SIP and XMPP, but also more than a few key differences. SIP's main focus is on establishing, modifying, and terminating multimedia sessions whereas the focus of XMPP is on delivering a federated network of connected entities capable of communicating with each other through their own trusted servers.

Although they function in two totally different matters with different terminology, motivations and primary uses, both SIP and XMPP can be used for two major purposes: presence, and communications sessions (voice, video, and IM). SIP began as a VoIP protocol but later layered in SIMPLE [RFC 3428], which handles presence and messaging. XMPP began as a presence and IM protocol but now can also do voice communications via Jingle [XEP-0166].

A popular example of an XMPP client is Google Talk, which uses XMPP for instant messaging and presence and an older (and slightly different) version of what would later become the Jingle protocol to handle VoIP sessions.

Which protocol does it better?

SIP and XMPP work in different ways. SIP will run over UDP, TCP, and SCTP, while XMPP is TCP only. 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 a SIP header and body while XMPP sends its request, response, and error messages using XML via a streaming connection.

At their current states, SIP is more mature and full featured when it comes to VoIP, which translates to more complex call handling options for the end user. Some of this 'complexity' comes from supporting UDP, and some from the fact that there are more standards and support for SIP than there are for XMPP. For example, SIP allows resolution of endpoints at the server, whereas inherent in the XMPP protocol is the inability of servers to do much with an IQ [Section 9.2.3] other than route it to a single endpoint as defined in the IQ routing rules of the RFC.

On the other hand, XMPP is great for instant messaging and presence. XMPP-based software has been deployed widely across the Internet and there are many great clients (PSI, Adium, etc.) and providers to choose from. SIP could probably be just as good for IM if there was a good client and service provider, but that has not been the focus.

It’s not SIP vs XMPP, it’s SIP PLUS XMPP

We have two protocols that both excel at what they do. The logical step forward is to find a way to integrate SIP and XMPP into one solution. A growing number of software developers [sixpac] have expressed interest in building ‘dual-stack’ solutions, products built with the mentality that SIP and XMPP should be able to work together to deliver the best user experience.

We believe in this direction and our my.OnSIP product is a great example of it in action. In addition to being a corporate phone system replacement, OnSIP is also a SIP and XMPP hosting service. With our free SIP hosting offerings, our customers get SIP addresses with their own personalized domains. Our XMPP hosting service adds presence, phone presence (see if your coworkers are on the phone), and instant messaging.

Learn more about VoIP Fundamentals