Skip to content

Latest commit

 

History

History
123 lines (99 loc) · 5.3 KB

1_sip_voip.md

File metadata and controls

123 lines (99 loc) · 5.3 KB

University of Technology of Compiègne

Setting up a VoIP communication between a Raspberry Pi and an IP phone using an Asterisk IP PBX server

Guillaume Nibert
Supervisor: Dr. Ahmed Lounis

1. SIP protocol and VoIP communication

The first questions to ask before starting the implementation of this infrastructure are: What is VoIP? What is SIP and how does it relate to VoIP? What is the relationship between SIP and RTP?

Answering the first question requires understanding the internet stack (Internet protocol suite).

OSI Model TCP/IP Model
Application SIP, HTTP, SMTP, FTP, RTP...
Presentation
Session
Transport UDP/TCP
Network IP
Data link 802.3 MAC, 802.11 MAC, EAP...
Physical 802.3 PHY, 802.11 PHY, cuivre, fibre optique...

(Figure 2 - Internet protocol stack)

VoIP stands for Voice over Internet Protocol, voice is specifically an analogue signal which can be acquired by means of a microphone and then digitally encoded using an analogue-to-digital converter. Once encoded, the data can be passed through the Internet protocol stack. In this diagram, it is therefore possible to transfer voice encoded using the HTTP protocol, transported in TCP, in an IP network via an Ethernet link to another device using this same protocol stack. Note that not all application protocols are necessarily suitable for transferring encoded voice. Some are suitable for real-time communication, e.g. transmission of encoded voice (RTP), others for establishing a communication (SIP)...

SIP (Session Initiation Protocol) is the protocol that allows establishing a communication between endpoints. Typically, an endpoint initially acts as a SIP client to contact another endpoint. It first queries a SIP server which provides it with information about the identity of this other endpoint and how to access it in the IP network. Once the information has been received, communication takes place directly between the two endpoints via the Real-time Transport Protocol (RTP). This protocol transmits the encoded voice. Once the communication is over, SIP takes over again to close the connection (session).

Figure 3 - Establishment and termination of a VoIP communication using SIP - attribution: 3cx.com

(Figure 3 - Establishment and termination of a VoIP communication using SIP - attribution: 3cx.com)

Going back to our very first diagram, for the establishment of a communication (e.g. Raspberry Pi calls Alcatel):

  1. RPi sends a contact request to Alcatel (Invite) through Asterisk. Alcatel receives the Invite response, rings and indicates RPi that it is ringing. Someone picks up the Alcatel, the contact is established, so...
  2. ...RTP takes over and transfers the voices between the two devices in direct connection (without going through Asterisk).

Figure 4 - Établissement d’une communication téléphonique entre le Raspberry Pi et le téléphone Alcatel IP Touch 4018 EE

(Figure 4 - Établissement d’une communication téléphonique entre le Raspberry Pi et le téléphone Alcatel IP Touch 4018 EE)

Once the call is over (one person hangs up), SIP takes care of closing the session between the two participants.