Site logo
Stories around the Genode Operating System RSS feed
Josef Söntgen avatar

A SIP client for Genode on the PinePhone


We ported the "Linphone Console Client" and the "SIP Client for Ubuntu Touch" to Genode to expand the available features on the PinePhone when it comes to mobile communication. This article illustrates the integration and describes how you can experience it yourself.

Overview

So far when using Sculpt on the PinePhone only the regular calling mechanism was available while a ready-to-use VoIP solution was not yet provided. One of the technologies used for VoIP is the “Session-Initiation-Protocol” (SIP) and one software-suite implementing it is Linphone, a open source VOIP project. The current use-case consists of communication between two parties via an intermediary (proxy) that maintains the connectivity.

We started our journey by investigating how feasible it would be to bring this project to Genode by building the linphone-sdk first on Linux to gather initial insight. The SDK comprises multiple git repositories and uses cmake as its build-system. In an iterative process we reduced the features until we ended up with an voice-only but ZRTP secured console client that could be used to login into an existing SIP account. For that we used a free account on the Linphone project's server.

The next order of business was making the same configuration available on Genode. As we do not have to interface with the linphone-sdk directly - after all our POSIX runtime contains all required services so reusing the available back ends in the SDK is possible - we fired up goa. Goa eases building software that uses an already supported build-system, which cmake fortunately is. We will spare you the details, the goa-project files are available here, the porting effort was mostly straight-forward with one or the other tweak here and there. Eventually we were able to use the same console client on Genode as we did on Linux before.

Using an interactive console client on a device such as the PinePhone, while possible, provides a somewhat cumbersome user experience. Besides the existing clients for the prominently used mobile OSes, there is also a Qt-based desktop client. It stands to reason, however, if it will work well on the PinePhone. On the other hand there are other mobile OSes out there - maybe there is a Linphone GUI available for some of them? There is indeed. For "Ubuntu Touch" there exists a SIP client that under the hood uses Linphone. We had tinkered with the Ubuntu Touch UI toolkit in the past and as it is also used by the Morph Browser, of which a Genode port is on hand, we gave that project a go.

The SIP Client for Ubuntu Touch is written in QML where custom plugins provide the integration with the Linphone client. On one hand we had to alter those plugins slightly as they relied on functionality in the Qt5 framework that is not available on Genode and on the other hand stripped the QML-code down to the limited features-set we want to address at the moment:

  • Allow for logging in and out of an existing SIP account

  • Answering and initiating of a normal voice-call (one at a time)

  • Call-history and short-dial menu

  • “Short-authentication-string” (SAS) prompt

Most of those features were already available in the GUI and only needed minor adjustments. Like the linphone-sdk the goa-project for linphone-simple is available here.

Integration

With the client and a useable GUI in place, the following section details how both components are integrated into a preset for Sculpt that configures the runtime portion of Sculpt and what other components play a role. The diagram below depicts its structure.

Both components each have their own requirements:

The client needs access to the network, has to store its configuration, and requires access to the audio subsystem. It is the driving force behind the operation while it receives its instructions from the GUI.

The GUI needs access to the GPU driver, as required for fluent rendering of QML on the PinePhone, as well as access to input events for user interaction.

Naturally these requirements are satisfied by other components also incorporated into the preset:

  • The Dynamic chroot component selects and limits the file-system access of the client to the configured directory. In case of the PinePhone it points to the /recall/linphone directory on the SD-card.

  • The SNTP component provides the client with a correct real-time clock value. Note that the SNTP component uses a different TCP/IP-stack then the client itself.

  • The Audio driver component makes the speaker as well as the mic available to the client.

  • The GPU driver component allows the GUI to render the interface via OpenGL on the GPU.

  • The Touch keyboard collects the touch events and translates them into key events that are then consumed by the GUI.

The client and the GUI themselves are connected via the Terminal crosslink component where the control channel is formed by connecting stdout from the GUI to stdin from the client and vice versa.part

As denoted by the illustration, the client actually functions as a Daemon that is running in the background, while the GUI is the App the user interacts with.

Usage guide

A word of caution: the current version should be treated as proof-of-concept rather than a “production-ready” appliance (see Known short-comings).

A ready-to-use Sculpt image featuring the linphone preset is available at cnuke's depot that can be installed via Sculpt's on-target system update mechanism.

Selecting the preset will trigger the download of all dependencies. This takes some time and is best done on an unmetered connection, e.g. via WLAN.

Main-Page while not being logged-in

After loading the preset for the first time, you will notice a red bubble denoting that you are offline. To change that, the Settings-Page reachable via the gear icon in the top-right corner can be used to login into an existing SIP account by pressing the Login button. Enter your user-name in the corresponding input field, select or enter the domain and finally enter your password (note: the GUI forces the usage of TLS by unconditionally appending ';transport=tls' to the registration command).

Settings-Page when not logged-in

If you entered the account information correctly you should be logged in after a few seconds. If that is not the case, press the Logout button and try again. Sometimes it may be necessary to restart the preset by loading the empty preset first and the linphone preset afterwards to restart the client. At the moment there is no direct feedback-channel in case the client behaves erroneously (and the GUI is stuck in limbo).

After going back to the Main-Page by pressing the arrow in the top-left corner you should see a green bubble followed by your account (identity and domain) information. You are now ready to receive and to initiate calls.

Main-Page after succesful login

An out-going call is performed by entering the contact information into the input field at the bottom of the page - the format should by identity@domain.tld - and pressing the green button.

When you receive a call a pop-up will be displayed allowing to accept or decline the call. The call commences if you accept by pressing the green button.

Pop-up shown on incoming call

If it is secured by ZRTP another pop-up showing the SAS is displayed after some short amount of time.

Show short-authentication-string

Accepted incoming and out-going calls will be stored in the contacts history list. Pressing and dragging an entry to the right allows for removing the entry by pressing the recycle-bin icon.

Delete contact from list

Pressing and dragging right allows for adding the contact into the short-dial list if there is an unused slot left.

Add contact to favorites

The short-dial list can also be managed manually by pressing the icon for some time until a pop-up is displayed allowing you to add or to remove a favorite contact.

Manage favorite contact

While this concludes the operation of the linphone preset, there are two options of configuration you need to be aware of. Both concern the device settings in the Leitzentrale found in its Device section.

The first one is the Microphone option that configures who may access the microphone. The default setting, Phone, switches it to be used for regular phone-calls while On makes it available for use in the runtime. For the linphone preset On is the proper value.

The second one is the Speaker option that configures if the big speaker on the back of the PinePhone is used in addition to the small speaker on the front at the top. The default setting, Ring, configures its usage in a way that is useful for regular phone-calls where the big speaker is enabled for playing the ring-tones but is muted during a call. On and Off control the speaker explicitly. To prevent unexpected echo issues where the microphone at the back of the PinePhone picks received audio the Off setting should be used.

Happy calling!

Known short-comings

  • You cannot manage additional calls while already being in a call

  • You can initiate calls while not being logged in via the contact list and short-dial icons (for that the phone's local SIP account is used) but the network configuration will not allow for the call being accepted

  • The entered login information is not sanitized and my trigger erroneous behavior in the daemon

  • The daemon's DNS resolver is hard-coded to use 8.8.8.8