Asterisk Tutorial 35 — SIP in Detail

Introducing Asterisk & SIP in Detail

pascom
4 min readDec 16, 2015

Welcome back to the VoIP Guys Introducing Asterisk video series. Last time around we introduced Session Initiation Protocol (SIP), what it is and how it does. If you remember, we took a look at the SIP protocol stack, explaining SIP, SDP and the Payload. Well now it is time for SIP in detail, which means we are going to build on last time and take a closer look at SIP itself and the process behind starting a SIP session.

What is the SIP Handshake

A standard SIP session is structured in such a way that there are two “Call Legs”. The first leg is the start of the handshake and consists of one IP end point sending an “INVITE” to the IP PBX which then transmits the “INVITE” to another IP end point as illustrated below.

Once the “INVITE” is sent from the first device to the server, the server returns a “trying” signal and transmits the “INVITE” to the desired device to be included in the session. Next a “Ringing” signal is sent back through the server, followed by an “OK”. The session is then established by an “ACK” signal which completes the SIP handshake and the two devices can start communicating with one another using Real-Time Transfer Protocol (RTP).

However, there is another option. It could be that each device can speak to each other directly. Therefore, imagine a scenario where device A sends an invite via the server to device B and asks whether the device can be reached via the server, i.e Asterisk or mobydick (pascom). Device B responds saying yes, but we can also talk directly to each other. This is useful to know, as it means that the media can be transmitted directly, thus bypassing the PBX as shown below:

If you require call or voice recordings, then the stream must go through your Asterisk system. Moreover, if your require DTMF functionality at any point during your call flows, then in the simplest case the stream also needs to go through the server.

The questions is now when and why should you use SIP reINVITEs? In a nutshell, in a scenario where you do not need the payload to go through the server, then using reINVITES is much more effective in terms of performance. For example, if you have 1,000 users, that could create a substantial load on the server and if you do not need any server based functionality and they are connected on the same network for example, then it makes sense to reduce the strain on the server.

However, the simplest and easiest method is to route all traffic over the sever as 1. it works and 2. if you have multiple sites on different networks, routing traffic over the PBX server is the simplest option.

Mathias’ Top Tip

More than anything, it is important to understand the SIP protocol, that the initiation protocol and description protocol form a separate component routed one way and the payload is detached component that can be routed differently. This means, that not only understanding the concept is important, but also being able to read SIP is essential especially when using reINVITES and when it comes to debugging.

Next time around, we go into yet more detail about SIP before starting on debugging.

Upgrade your business communications with a free pascom Cloud phone system today

More Info

pascom are the developers of the enterprise grade pascom VoIP phone system software. As an open standards IP PBX, pascom systems offer a cost effective alternative to proprietary solutions and provides businesses with a fully featured Unified Communications solution to boost productivity, increase mobility and reduce costs.

For more on our pascom phone system or to arrange a personalised demo, give us a call on +49 991 29691 200. Alternatively, contact us via our website or take our pascom phone system for a test drive with our Free Edition and discover first hand how your business can benefit.

Until next time — Happy VoIPing!

--

--