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
All endpoints are connected to the Asterisk server. It is therefore possible to call from the Raspberry Pi to the Alcatel or from the Alcatel to the Raspberry Pi.
In order to carry out the communication, you must first have launched the Asterisk server, the TFTP server, turned on all the peripherals and connected an audio output on the Raspberry Pi (audio jack, Bluetooth or HDMI) to be able to listen to the audio stream.
- Launch a terminal and run linphonec.
linphonec
- Call the Alcatel IP Touch phone, it has the number
5001
(see part 2 - SIP configuration and user creation).
linphonec> call 5001
Output (with comments):
# Error message, not important, video is disabled, we are only doing VoIP. 2021-02-09 13:30:36:367 ortp-error-LinphoneCore has video disabled for both capture and display, but video policy is to start the call with video. This is a possible mis-use of the API. In this case, video is disabled in default LinphoneCallParams # Linking to the Alcatel phone Establishing call id to sip:5001@192.168.1.80, assigned id 1 # The Alcatel phone has been found, it is contacted, it rings on the Alcatel # side. Contacting sip:5001@192.168.1.80 linphonec> Call 1 to sip:5001@192.168.1.80 in progress. linphonec> Call 1 with sip:5001@192.168.1.80 connected. # We picked up the Alcatel phone. Call answered by sip:5001@192.168.1.80 # Communication is in progress, audio is playing, settings are adjusted. linphonec> 2021-02-09 13:30:36:563 ortp-error-no such method on filter MSPulseWrite, fid=16394 method index=2 Media streams established with sip:5001@192.168.1.80 for call 1 (audio). Call is updated by remote. linphonec> 2021-02-09 13:30:40:761 ortp-error-no such method on filter MSPulseWrite, fid=16394 method index=2 Call parameters were successfully modified. linphonec> Media streams established with sip:5001@192.168.1.80 for call 1 (audio). Call is updated by remote. linphonec> Call parameters were successfully modified. linphonec> Media streams established with sip:5001@192.168.1.80 for call 1 (audio). # The call has just ended, someone has hung up one of the devices. Call terminated. linphonec> Call 1 with sip:5001@192.168.1.80 ended (No error).
When the call is initiated, the Alcatel phone screen displays the following:
The communication therefore works in one direction. Let's see what happens if the Alcatel calls the Raspberry Pi.
- From the phone, call the Raspberry Pi's number
5002
(see part 2 - SIP configuration and user creation).
- From the Raspberry Pi terminal, make sure that linphonec is active. When the Alcatel launches its call, it is received in the terminal:
Output:
linphonec> Receiving new incoming call from "Alcaltel IP Touch" <sip:5001@192.168.1.80>, assigned id 3
To answer it, just type answer
and the call ID:
answer 3
The communication is launched and works in the same way.
Output:
linphonec> Receiving new incoming call from "Alcaltel IP Touch" , assigned id 3 answer 3 Connected. linphonec> Call 3 with "Alcaltel IP Touch" connected. 2021-02-09 13:46:28:345 ortp-error-no such method on filter MSPulseWrite, fid=16394 method index=2 Media streams established with "Alcaltel IP Touch" for call 3 (audio). linphonec> Call is updated by remote. linphonec> 2021-02-09 13:46:28:424 ortp-error-no such method on filter MSPulseWrite, fid=16394 method index=2 Call parameters were successfully modified. linphonec> Media streams established with "Alcaltel IP Touch" for call 3 (audio). Call is updated by remote. linphonec> Call parameters were successfully modified. linphonec> Media streams established with "Alcaltel IP Touch" for call 3 (audio). Call terminated. linphonec> Call 3 with "Alcaltel IP Touch" ended (No error).
The communications therefore work in both directions. The objective of the next part is to create a graphical interface in JavaScript on the Raspberry Pi side, more user-friendly than the linphonec command line client.