LinphoneをRaspberry PIなどのコンピュータボードでデーモンとして常駐させ、SSH接続でコンソールから遠隔操作するのであれば、linphone-nogtkではなく linphone-cli
を利用します。
ホストマシン:OS
Orangepi PC : Armbian 22.11.4 Bullseye with Linux 5.15.89-sunxi
インストール
$ sudo apt install linphone-cli
Linphoneの各種設定を書出す設定ファイル
.linphonerc
とユーザ登録に必要なデータベース用ディレクトリ /home/USER/.local/share/linphone
を作成します。
$ mkdir -p /home/USER/.local/share/linphone
$ touch .linphonerc
ログファイル出力(オプション)を指定して起動
$ sudo -H -u username linphonecsh init -c /home/USER/linphone/.linphonerc -d 6 -l /tmp/linphone-log.txt
予めLinphoneのホームページで登録したユーザでSIPサーバへログインします。このユーザはデフォルトユーザとしてLinphoneアプリの設定ファイルとデータベースに登録されます。
$ linphonecsh register --host sip.linphone.org --username user_name --password xxxxxxx
SIPサーバ側でユーザ認証されたかどうか確認して下さい。
$ linphonecsh status register
registered, identity=sip:[email protected] duration=3600
システムデーモンとして登録するためのスクリプトを作成
/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
sudo -H -u username linphonecsh init -c /home/USER/.linphonerc -d 6 -l /tmp/linphone-log.txt
実行権の付与
$ sudo chmod +x /etc/init.d/linphonecsh
起動時スクリプトの登録
$ sudo update-rc.d linphonecsh defaults
Ubuntu Manpage: update-rc.d - install and remove System-V style init script links
動作チェック
呼出音の設定以外は $ linphonecsh generic " ~ "
コマンドで設定。動作中のLinphoneに対して設定を上書きします。
サウンド設定追加
$ linphonecsh generic "soundcard list"
0: ALSA: default
1: ALSA: H3 Audio Codec
2: ALSA: sun9i-hdmi
$ linphonecsh generic "soundcard use 0"
Using sound device ALSA: default
STUNサーバを指定、firewallコマンドで有効化
$ linphonecsh generic "stun stun.linphone.org"
Stun server: stun.linphone.org (disabled - use 'firewall stun' to enable)
$ linphonecsh generic "firewall stun"
firewallコマンド
$ linphonecsh generic "help firewall"
'firewall' : show current firewall policy.
'firewall none' : use direct connection.
'firewall nat' : use nat address given with the 'nat' command.
'firewall stun' : use stun server given with the 'stun' command.
'firewall ice' : use ice.
'firewall upnp' : use uPnP IGD.
ICEを有効化
$ linphonecsh generic "firewall ice"
Using ice with stun server �a to discover firewall address
IPv6有効化の確認
$ linphonecsh generic "ipv6 status"
ipv6 use enabled: true
受信音の設定
受信時の再生音に関してはデフォルトでも未設定のため、Linphone停止後、受信時の再生音のディレクトリとファイル名を以下の[sound]
セクションに追加する必要があります。
local_ring=/usr/share/sounds/linphone/toy-mono.wav
.linphonerc
[sound]
remote_ring=/usr/share/sounds/linphone/ringback.wav
local_ring=/usr/share/sounds/linphone/toy-mono.wav
playback_gain_db=0.000000
mic_gain_db=0.000000
ringer_dev_id=ALSA: default
playback_dev_id=ALSA: default
capture_dev_id=ALSA: default