Saturday, October 11, 2008

Differences between SIP and HTTP

I was recently asked to justify my smug all-knowing grin when I was recently told that "SIP seems as simple as HTTP"

I can understand how someone who has seen a few SIP messages in a book or in tshark can come to that conclusion, or perhaps even read a summary in a SIP book.  But, that's where the similarities end.  As soon as you start to deal with SIP at a protocol level, you'll come to realise why it's such a different beast from HTTP.

Similarities

SIP has a similar looking textual representation to SIP.

Caveat emptor: they're actually rather different - a validating SIP header parser will not parse HTTP, and vise versa.

Both have 3 letter response codes in responses.

However a response code in HTTP doesn't mean the same thing in SIP.  Both sit in entirely difference namespaces.

Both have normative references to rfc2617.

Except functionality like nonce counts, multiple proxy hops, and Authentication-Info are very confused in SIP.

 

Differences

SIP initiates sessions.  HTTP transfers data.

This is the key one.  HTTP was designed as a transfer protocol.  SIP was designed for session initialisation.

SIP is for signaling, and isn't designed for transferring the data for the session itself.  RTP, MSRP, and XMPP are all examples of the session transport.

HTTP has a strict client/server model.  In SIP, the UA is a client and server.

A SIP client is schizophrenic.  One second it's a client, then before it knows it, it's a server!  This is an important part of SIP - sessions are bi-directional.  All agents are both client's and servers.

A transaction in SIP can span multiple messages

Some of which are hop-by-hop (ACK to IxT failure), others are end-to-end (ACK to IxT 2xx).

Infact, SIP has a fairly complex state machine.  HTTP doesn't.  A Request results in a response.  Simple!

SIP has provisional responses

That can go on for an age in SIP.  Resources in a large scale SIP platform need to be carefully optimised to handle the very common case of a request waiting a very long period of time for a response - for example while a user's phone rings.  Because of this, provisional responses are sent before the final one.

SIP R-URI's can be modified as they traverse "the network"

When a SIP message is sent out from a UA, it only really knows it's next hop (excluding RRiing).  Each hop then takes responsibility for passing it on to the next hop - and indeed may even change the real target as it progresses.

HTTP on the other hand doesn't generally change the URL (front end reverse proxies excluded) without doing some nasty hacks like wireless portals, MNOs, and hotels tend to.

SIP messages are processed on a hop by hop basis.  HTTP can stream responses back.

A SIP message goes from hop to hop, completing each hope before continuing to the next.  Imagine in HTTP downloading the entire file to the proxy before you could start to download it to the web browser!

This all stems from the fact SIP only handles signaling, so it contains only (relatively) small messages.  HTTP on the other hand has no real limits on response size.

HTTP provides an entire architecture for caching.  SIP doesn't know anything about a caching proxy. 

Even a non-caching (pass through) HTTP proxy has very few similarities to a SIP proxy.

SIP doesn't know anything about caching, nor would it be valid to cache a response and provide it to something outside of the transaction.

SIP can (and most commonly does) run over unreliable protocols.

HTTP requires a reliable transport.  Congestion control is handled at the transport level.

SIP is broken.  HTTP ain't.

SBCs, HERFP, DTMF, identity - it's all rather broken in SIP.  HTTP seems to be fairly clean in it's implementation - SIP is far from it.

I'm still waiting for one person to tell me a single part of SIP that isn't broken in one form or another.  And yes, I can use the forking card when I see fit :-)  answers on a postcard to theo@crazygreek.co.uk please.

Labels: ,

posted by Theo Zourzouvillys at

1 Comments:

Blogger Jon Farmer said...

I also smiled at a comment by a MD of a ITSPA who gave a talk at Convergence Summit South recently. To paraphrase he said "SIP is simple its like HTTP". I wasn't asked to justify my response, maybe I should have cleared my throat loudly and sarcastically.

October 25, 2008 2:21 PM  

Post a Comment

Links to this post:

Create a Link

<< Home