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
The installation and configuration of a SIP client on the Raspberry Pi is necessary to communicate with VoIP. This client will connect to the Asterisk server and depending on the number the client is calling, the server will use the dial plan defined in extensions.conf to contact the right endpoint (Alcatel phone for example).
- OS: Raspberry Pi OS Buster (arm64), the 64-bit version is only very recent but seems to be promising. Indeed, it is more powerful than the 32 bits version (armhf) (9). This is a significant advantage, especially on a Raspberry Pi 3B+ which will be used in desktop mode. Any improvement in performance is worthwhile. Furthermore, Raspberry Pi OS is a system officially maintained by the Raspberry Pi Foundation.
- SIP client: linphonec, the command line version of Linphone. It is stable and works perfectly on Raspberry Pi OS. It is open source. Unfortunately, the popular client Jami (formerly GNU Ring), developed by Savoir-faire Linux does not seem to work well with Raspberry Pi OS.
Having an up-to-date Raspberry Pi 3B+ running Raspberry Pi OS Buster (64-bit) connected to the local network and the internet, also with SSH access (see appendix A2 of the PDF report for the detailed implementation of this requirement). The Asterisk server must be running.
Consider in this section the following information from this machine:
IP address | User | Password |
---|---|---|
Ethernet: 192.168.1.82 | pi | voippiutc |
Wi-Fi: 192.168.1.92 |
- Start the Raspberry Pi then launch a terminal and install Linphone.
sudo apt install linphone -y
- Once the installation is complete, register the associated
rpi
user on the server.
linphonec
#linphonec> register sip:login@domain domain <password> linphonec> register sip:[email protected] 192.168.1.80 22222222
The rpi
client is connected to the Asterisk server. It can therefore contact the Alcatel telephone and vice versa.
If the registration on the server was successful, the previously executed command returns this:
linphonec> Refreshing on sip:[email protected]…
linphonec> Registration on sip:192.168.1.80 successful.
linphonec>
On a server console, type the command sudo asterisk -rvvv.
Once entered, type the command pjsip show endpoints. If the Raspberry Pi's SIP client is connected then the console will return this:
asterisktz*CLI> pjsip show endpoints
Endpoint:
I/OAuth:
Aor:
Contact:
Transport:
Identify:
Match:
Channel:
Exten: CLCID:
===============================================================================
Endpoint: alcatel/5001 Unavailable 0 of inf
InAuth: alcatel/alcatel
Aor: alcatel 1
Endpoint: guillaume/5003 Unavailable 0 of inf
InAuth: guillaume/guillaume
Aor: guillaume 1
Endpoint: rpi/5002 Not in use 0 of inf
InAuth: rpi/rpi
Aor: rpi 1
Contact: rpi/sip:[email protected];transport=udp cec2f9dd2f NonQual nan
Objects found: 3
It is clear that the client has an IP address of 192.168.1.82 and is connected. The information "Not in use" indicates that there is no call in progress.
The Alcatel phone is still not connected, it is time to integrate it into the system.
(9): bluesman, 64 bit Raspberry Pi OS is here!, Audiophile Style, 4th june 2020, available at: https://audiophilestyle.com/forums/topic/59499-64-bit-raspberry-pi-os-is-here/.