Creating VOIP Infrastructure for testing chips

Suresh Agarwal
4 min readAug 24, 2021

In the chip testing world, there is a need to make telephonic call between two devices. Typically there is a mobile phone that can make and receive calls, and these calls may be redirected to headsets or earbuds. Many companies making these chips need to test this functionality in automation by creating such infrastructure internally.

In this article we will explore how to simulate these real world calls at the same time reducing the cost of buying sim card, monthly plan charges and the possibility of losing data to the network provider.

One of the ways this can be done is by creating VOIP infrastructure using internal company Wi-Fi network so that VOIP calls can be made between multiple android phones connected to Wi-Fi or application which will behave as sip client running on desktop.

We can use below options to create VOIP infrastructure with minimal cost to company:

a) VOIP server

b) SIP client application

c) SIP client running on android phones

Lets do a deep dive into the above options:

a) VOIP server: Asterisk server is a good option for setting the VOIP server very quickly on linux box.

1) sudo apt install asterisk

2) sudo systemctl restart asterisk

3) sudo systemctl enable asterisk

4) Open file “sip.conf” available at path “/etc/asterisk”. Modify this file as below where we are creating sip clients which will be used for testing with hostname_xxx.

[general]
context=default
secret=12345
allow= all[{server_hostname}_001]
type=friend
context=internal
host=dynamic
secret=12345
[{server_hostname}_002]
….
[{server_hostname}_003]

5) Open file “extensions.conf” available at path “/etc/asterisk”. Modify this file as below to give option of dialing and hang-up call with sip clients registered to asterisk server.

[internal]exten => {server_hostname}_001,1,Dial(SIP/{server_hostname}_001)
exten => {server_hostname}_001,n,Hangup()
exten => {server_hostname}_002,1,Dial(SIP/{server_hostname}_002)
exten => {server_hostname}_002,n,Hangup()
….

6) Restart server using command “sudo systemctl restart asterisk”

7) Check status of server “sudo systemctl status asterisk”

8) Login into the server for running any command “sudo asterisk -rvvvvv” if required. You can send commands defined in this link in CLI mode.

Now we have setup asterisk server with defined number of sip clients in above config and gave secret key to them. These extension names and secret key will be used in later steps to set up sip client on Linphone and android phone.

AUTOMATION: All above commands of installing and configuring asterisk server on Linux box can be automated by writing shell script. We can write python script to change config automatically for sip clients using yaml file and updating with jinja2 package in python.

b) Sip client application: Linphone(softphone) application is a very good option which can be installed on windows/Linux pc easily.

1) Download Linphone application from this path https://new.linphone.org/technical-corner/linphone?qt-technical_corner=2#qt-technical_corner for windows machine and install that. If Linux, then execute following command

add-apt-repository ppa:linphone/release
apt-get update
apt-get install linphone -y
sudo modprobe snd-dummy(to create dummy soundcard)

To make sure this setting persists upon reboot of the machine we need to add snd-dummy to /etc/modules file.

2) Start the linphone console tool called linphonec manually.
Windows: linphonec is found in C:\Program Files (x86)\Linphone\bin
Linux: linphonec found in /usr/bin

3) Create Linphone config file for windows/linux and provide empty log file in below command to start linphone.

linphonec -c <CONFIG_FILE_PATH> -d 6 -l <LOG_FILE_PATH>

If running more than one linphone client on same machine ensure “sip_port”, “audio_rtp_port” in config file for each client is different.

4) Run following commands to register, setting soundcard before call, making call, answer call, play audio file, record audio file, checking states etc.

>register sip:<FULL_SIP_URL> sip:<SIP_SERVER_NAME> <PASSWORD>
>soundcard use files
>call <FULL_SIP_URL>
>answer
>play <FULL_PATH_TO_WAV_FILE>
>record <FULL_PATH_TO_WAV_FILE>
>terminate
>states
>unregister
>quit

Commands dictionary and usage can be found at this link.

AUTOMATION: All above usage of Linphone can be automated by writing one simple python class for SIP client and calling above commands on need basis.

c) Sip client on Android phones: Most android phones has the option where phone can be registered as sip client to VOIP server. Below option may be different based on android phone maker but phones will have these option in one way or another to add sip client.

1) Click on call button on phone

2) Go to call settings option in call

3) Go to sip accounts and add details of new sip account. Add sip client name as username and secret key which was chosen in asterisk server. Server will be hostname of pc where asterisk server was installed.

Username:{server_hostname}_001Password: 12345Server: {server_hostname}

4) After this, you should be able to see “receiving calls” at below sip client which you have added which means client is added successfully.

AUTOMATION: All above GUI operation on android phones can be done using Appium/adb .

Once you create Asterisk server within company network, you can use multiple android phones/softphones Linphone application for VOIP call testing. This infrastructure can be used for testing android phones, data quality on devices connected to phone, Wi-Fi strength or quality of data received during phone calls.

Happy Automating to All 😊

--

--

Suresh Agarwal

Staff Engineer/Manager at Qualcomm, Bengaluru, I enjoy to build test automation frameworks for testing ICs, processors and improve product quality and TTM.