FicusOnline Blog

Linux, opensource projects tips 

2021/05/04  Linphone, LInux, Orange Pi, Raspberry Pi, Ubuntu


Updated Armbian on Orange Pi PC to the latest version, but Linphone version is still old 3.12, so I decided to build it from the source.

Previously, needed to build from the source of Linphone desktop version, but now Linphone desktop seems to be able to build from Linphone-SDK directly.


Conditions

Armbian 21.02.3 Buster with Linux 5.10.21-sunxi(Orange Pi PC)
Linphone build and install version : 4.5.0(Linphone without user interface)

 

In Advance

The latest vesion of Armbian is based on Debian Buster, so refer to linphone-sdk/docker_files, in advance, install the packages required to build Linphone. 

Bug: liblinphone won’t initialize correctly if the data directory (for persistent storage) is not created. To workaround do:
Make the following directory
$ mkdir -p ~/.local/share/linphone

bc-dev-debian10

https://github.com/BelledonneCommunications/linphone-sdk/blob/master/docker-files/bc-dev-debian10

FROM debian:buster

MAINTAINER Ghislain MARY <ghislain.mary@belledonne-communications.com>


# Configure locale
RUN apt-get update && \
    apt-get install -y locales && \
    apt-get clean && \
    echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
    locale-gen
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

ENV SHELL=/bin/bash
#ENV PS1='\[\e[33m\]\u@bc-dev-debian9>\[\e[0m\] '

# Install common general tools
RUN apt-get update && \
    apt-get install -y nano sudo vim && \
    apt-get clean

This file has been truncated. show original 

 


Install Dev Tools

$ sudo apt-get install -y alien at autoconf bison ccache clang cmake doxygen elfutils g++ gdb git graphviz intltool libtool lsb-release make nasm ninja-build openssh-client patch yasm

 

Install Dependencies 

Install dependency packages for dev tools.

$ sudo apt-get install -y libasound2-dev libavcodec-dev libavutil-dev libbsd-dev libegl1-mesa-dev libglew-dev libgsm1-dev libmariadbclient-dev libmbedtls-dev libopus-dev libpq-dev libpulse-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libsrtp2-dev libssl-dev libswscale-dev libturbojpeg0-dev libv4l-dev libvpx-dev libxerces-c-dev libxml2-dev libxv-dev xsdcxx

 

Download linphone-sdk source

As should be also downloaded the related packages or sources to build Linphone, add --recursive option.

$ git clone --branch release/4.5 https://gitlab.linphone.org/BC/public/linphone-sdk.git --recursive

 

Build(Compile) Options

Move to linphone-sdk derectory, then confirm build options.

$ cd linphone-sdk
$ cmake -LA

-- Enabled features:
 * Tools, Enable tools binary compilation.
 * Xml2, Enable bc version of libxml2
 * Sqlite, Enable bc version of sqlite3
 * Zlib, Enable bc version of zlib
 * Mbedtls, Crypto stack implementation based on mbeddtls.
 * Non free codecs, Allow inclusion of non-free codecs in the build.
 * SRTP, SRTP media encryption support.
 * ZRTP, ZRTP media encryption support.
 * GSM, GSM audio encoding/decoding support.
 * iLBC, iLBC audio encoding/decoding support.
 * OPUS, OPUS audio encoding/decoding support.
 * Speex, Speex audio encoding/decoding support.
 * Video, Ability to capture and display video.
 * V4L, Ability to capture and display video using libv4l2 .
 * jpeg, JPEG support with libjpeg-turbo.
 * FFmpeg, Some video processing features via FFmpeg: JPEG encoding/decoding, video scaling, H264 decoding...
 * OpenH264, H.264 video encoding/decoding support with the openh264 library (require license).
 * VPX, VPX (VP8) video encoding/decoding support.
 * Assets, Enable packaging of assets (ringtones) when building the SDK.
 * DB Storage, Enable the database storage.

-- Disabled features:
 * Embedded OpenH264, Embed the openh264 library instead of downloading it from Cisco.
 * Unit tests, Enable unit tests support with BCUnit library.
 * Debug logs, Enable debug level logs in libinphone and mediastreamer2.
 * Doc, Enable documentation generation with Doxygen
 * unmaintained, Allow inclusion of unmaintained code in the build.
 * Soci mysql, Enable mysql support of SOCI
 * Sanitizer, Enable Clang sanitizer
 * HW Sanitizer, Enable Android HW sanitizer
 * Polarssl, Crypto stack implementation based on polarssl.
 * Tunnel, Secure tunnel for SIP/RTP (require license).
 * RTP Map always in SDP, Always include rtpmap in SDP.
 * mDNS, Multicast DNS support
 * DNS_SERVICE, Enable Apple DNS Service. Available on Mac and iOS. Incompatible with ENABLE_MDNS.
 * GPL third parties, Usage of GPL third-party code (FFmpeg and x264).
 * WebRTC AEC, WebRTC echo canceller support.
 * WebRTC AECM, WebRTC echo canceller for mobile support.
 * WASAPI, Windows Audio Session API (WASAPI) sound card support.
 * AMRNB, AMR narrow-band audio encoding/decoding support (require license).
 * AMRWB, AMR wide-band audio encoding/decoding support (require license).
 * Codec2, Codec2 audio encoding/decoding support.
 * G729, G.729 audio encoding/decoding support.
 * G729B CNG, G.729 annex B confort noise generation.
 * G726, G.726 audio encoding/decoding support.
 * ISAC, ISAC audio encoding/decoding support.
 * Silk, Silk audio encoding/decoding support.
 * WebRTC VAD, WebRTC voice activation detector support.
 * BV16, BroadVoice 16 audio encoding/decoding support.
 * qrcode, QRCode support with zxing.
 * H263, H263 video encoding/decoding support (require license).
 * H263p, H263+ video encoding/decoding support (require license).
 * MKV, MKV playing and recording support.
 * MPEG4, MPEG4 video encoding/decoding support (require license).
 * X264, H.264 video encoding support with the x264 library (require license).
 * AAudio, AAudio Android sound card for Android 8+.
 * Camera2, Android capture filter using Camera2 API for Android 8+
 * PCAP, PCAP support.
 * GTK UI, Enable the GTK user interface of Linphone.
 * CXX wrapper, Build the C++ wrapper for Liblinphone.
 * CSharp wrapper, Build the C# wrapper from Liblinphone.
 * Swift wrapper, Build the Swift wrapper sources from Liblinphone.
 * Swift wrapper compilation, Compile and package the swift wrapper framework. Require at least cmake 3.16.3.
 * Jazzy doc, Build the Swift doc from Liblinphone.
 * Java wrapper, Build the Java wrapper from Liblinphone.
 * LIME, Enable Linphone IM Encryption support in  Liblinphone.
 * LIME X3DH, Enable Linphone IM Encryption version 2 support in  Liblinphone.
 * NLS, Enable internationalization of Linphone and Liblinphone.
 * Update Check, Enable update check.
 * VCARD, Enable vCard 4 support in Linphone and Liblinphone.
 * Advanced IM, Enable advanced instant messaging such as group chat.
 * Relative prefix, liblinphone and mediastreamer will look for their respective ressources relatively to their location.


  ***************************************************************************
  ***************************************************************************
  ***** Linphone SDK without third party GPL software                   *****
  ***** If you acquired a proprietary license from Belledonne           *****
  ***** Communications, this SDK can be used to create                  *****
  ***** a proprietary Linphone-based application.                       *****
  ***************************************************************************
  ***************************************************************************
  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/orangepipc/linphone-sdk
-- Cache values
CCACHE_PROGRAM:FILEPATH=/usr/bin/ccache
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
CMAKE_COLOR_MAKEFILE:BOOL=ON
CMAKE_CXX_COMPILER_LAUNCHER:PATH=/usr/bin/ccache
CMAKE_C_COMPILER_LAUNCHER:PATH=/usr/bin/ccache
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
CMAKE_INSTALL_MESSAGE:STRING=LAZY
CMAKE_INSTALL_PREFIX:PATH=/home/orangepipc/linphone-sdk/linphone-sdk/desktop
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
CMAKE_SKIP_RPATH:BOOL=NO
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
ENABLE_ADVANCED_IM:BOOL=OFF
ENABLE_AMRNB:BOOL=OFF
ENABLE_AMRWB:BOOL=OFF
ENABLE_ASSETS:BOOL=ON
ENABLE_BV16:BOOL=OFF
ENABLE_CAMERA2:BOOL=OFF
ENABLE_CODEC2:BOOL=OFF
ENABLE_CSHARP_WRAPPER:BOOL=OFF
ENABLE_CXX_WRAPPER:BOOL=OFF
ENABLE_DB_STORAGE:BOOL=ON
ENABLE_DEBUG_LOGS:BOOL=OFF
ENABLE_DOC:BOOL=OFF
ENABLE_EMBEDDED_OPENH264:BOOL=OFF
ENABLE_FFMPEG:BOOL=ON
ENABLE_G726:BOOL=OFF
ENABLE_G729:BOOL=OFF
ENABLE_G729B_CNG:BOOL=OFF
ENABLE_GPL_THIRD_PARTIES:BOOL=OFF
ENABLE_GSM:BOOL=ON
ENABLE_GTK_UI:BOOL=OFF
ENABLE_H263:BOOL=OFF
ENABLE_H263P:BOOL=OFF
ENABLE_HW_SANITIZER:BOOL=OFF
ENABLE_ILBC:BO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
LINPHONESDK_NASM_PROGRAM:FILEPATH=/usr/bin/nasm
LINPHONESDK_PLATFORM:STRING=Desktop
LINPHONESDK_VERSION:STRING=4.5.11-pre.1+e58d901
LINPHONESDK_YASM_PROGRAM:FILEPATH=/usr/bin/yasm
PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3

 

Create Makefile

Select some options you need, then execute cmake command to create the makefile. UI is inactive as default.

$ cmake -DLINPHONESDK_PLATFORM=Desktop -DCMAKE_C_FLAGS="-mfpu=neon" -DENABLE_OPENH264=ON  -DENABLE_LIME_X3DH=OFF -DENABLE_ADVANCED_IM=OFF -DENABLE_WEBRTC_AEC=OFF -DENABLE_UNIT_TESTS=OFF -DENABLE_MKV=OFF -DENABLE_FFMPEG=ON -DENABLE_CXX_WRAPPER=OFF -DENABLE_NON_FREE_CODECS=ON -DENABLE_VCARD=OFF -DENABLE_BV16=OFF -DENABLE_V4L=ON

 

Build

$ make

Created binaries into the following directory.

linphone-sdk/linphone-sdk/desktop/bin

 

Copy Binaries and Set Pass

Copy "desktop" directory to the directory you like(ex; /opt/linphone), and set the pass.

$ sudo mkdir /opt/linphone
$ sudo cp -r linphone-sdk/linphone-sdk/desktop /opt/linphone/

 

Add bin pass

$ sudo nano ~/.bashrc

export PATH="/opt/linphone/desktop/bin:$PATH"

 

Reload pass and confirm

$ source ~/.bashrc
$ echo $PATH
/opt/linphone/desktop/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

 

Add library pass

$ sudo nano /etc/ld.so.conf.d/linphone.conf

/opt/linphone/desktop/lib

 

Confirm

Confirm the version of Linphone

$ linphonec --version
version: 4.5.0

 

Help

$ linphonec
Warning: video is disabled in linphonec, use -V or -C or -D to enable.
linphonec> help
Commands are:
---------------------------
      help	Print commands help.
    answer	Answer a call
autoanswer	Show/set auto-answer mode
      call	Call a SIP uri or number
     calls	Show all the current calls with their id and status.
 call-logs	Calls history
    camera	Send camera output for current call.
      chat	Chat with a SIP uri
conference	Create and manage an audio conference.
  duration	Print duration in seconds of the last call.
  firewall	Set firewall policy
    friend	Manage friends
      ipv6	Use IPV6
      mute	Mute microphone and suspend voice transmission.
       nat	Set nat address
     pause	pause a call
      play	play a wav file
playbackga	Adjust playback gain.
     proxy	Manage proxies
    record	record to a wav file
    resume	resume a call
 soundcard	Manage soundcards
      stun	Set stun server address
 terminate	Terminate a call
  transfer	Transfer a call to a specified destination.
    unmute	Unmute microphone and resume voice transmission.
    webcam	Manage webcams
      quit	Exit linphonec
---------------------------
Type 'help <command>' for more details or
     'help advanced' to list additional commands.
linphonec> 

 

 


Linphone Auto Start Script

Make the following script 

$ sudo pico /etc/init.d/linphonecsh

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides:          linphone
    # Required-Start:    $remote_fs $syslog
    # Required-Stop:     $remote_fs $syslog
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Starts Linphone daemon.
    # Description:       Linphone is used to call and receive message on VoIP System.
    ### END INIT INFO
    export PATH=$PATH:/opt/no-ui/bin
    sudo -H -u user linphonecsh init -c /home/user_dir/.linphonerc -d 6 -l /tmp/log.txt

Add executable

$ sudo chmod +x /etc/init.d/linphonecsh

 

Register the above auto start script

$ sudo update-rc.d linphonecsh defaults

 

"$sudo -H -u user linphonecsh …"  error by root user.

Add /opt/linphone/desktop/bin to secure_path section.

$ sudo visudo
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/opt/linphone/desktop/bin"

 

Restart the host machine and check linphone process starting.

 

Reference Site

https://wiki.linphone.org/xwiki/wiki/public/view/Linphone/Linphone%20and%20Raspberry%20Pi/

Follow this article in F9E Forum

https://ficus-forum.myvnc.com/t/topic/329

GCC ARM Options

https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

mfpu options for Cortex-A processors
https://developer.arm.com/documentation/den0018/a/Compiling-NEON-Instructions/GCC-command-line-options/Option-to-specify-the-FPU

Orange Pi PC AllWinner H3 SoC

$ cat /proc/cpuinfo 
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 22.85
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 22.85
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 2
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 22.85
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 3
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 22.85
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

Hardware	: Allwinner sun8i Family
Revision	: 0000
Serial		: 02c00081b6111987

comments powered by Disqus