linphonec, linphonecshコマンドによる各操作

コマンドラインツールはlinphone-cliへ移行

linphone-cli
https://pkgs.org/download/linphone-cli

linphone-nogtk:コマンドラインツールによる設定ファイルの作成

Linphoneをバージョンアップする毎に以前の設定ファイルを引継いで使用してきましたが、バージョンアップ後、ディスコンの設定事項に起因するエラーが発生したため、やはりバージョンごとに新規に設定ファイルを作成した方がいいようです。

インストール環境

OrangePi PC:Ubuntu Bionic with Armbian Linux 4.19.62-sunxi
linphone-nogtk:version: 3.6.1

コマンドのみでLinphoneを制御するため、linphone-nogtkをインストールします。
インストール後Linphoneを起動するとコマンドプロンプトが表示されるので、使用条件などをコマンドで入力します。使用条件を反映した設定ファイル(不可視ファイル “.linphonerc” )がlinphone起動ディレクトリに作成されます。再起動後は、この設定ファイルが自動的に読み込まれます。

linphonecとlinphonecshコマンドについて

linphonecコマンド

linphonecコマンドはLinphpneの起動コマンドで、Linphone起動後のコマンドプロンプトにより、メッセージ・コール送受信、ユーザ認証、条件設定などを実行します。

$ linphonec

コマンド一覧

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

advancedコマンド一覧

linphonec> help advanced
Advanced commands are:
---------------------------
     codec	Audio codec configuration
    vcodec	Video codec configuration
        ec	Echo cancellation
        el	Echo limiter
nortp-on-a	Set the rtp_no_xmit_on_audio_mute configuration parameter
   vwindow	Control video display window
   pwindow	Control local camera video display (preview window)
  snapshot	Take a snapshot of currently received video stream
    vfureq	Request the other side to send VFU for the current call
    states	Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions
  register	Register in one line to a proxy
unregister	Unregister from default proxy
    status	Print various status information
     ports	Network ports configuration
     param	parameter set or read as normally given in .linphonerc
     speak	Speak a sentence using espeak TTS engine
 staticpic	Manage static pictures when nowebcam
  identify	Returns the user-agent string of far end
  ringback	Specifies a ringback tone to be played to remote end during incoming calls
  redirect	Redirect an incoming call
zrtp-set-v	Set ZRTP SAS verified.
zrtp-set-u	Set ZRTP SAS not verified.
---------------------------
Type 'help <command>' for more details.

ユーザ認証する場合(事前のユーザ登録はLinphoneのホームページで行います)

linphonec> help register
register <sip identity> <sip proxy> <password>

ex)

linphonec > register sip:[email protected] sip.linphone.org user100_password

linphonecshコマンド

linphonecshコマンドは、バックグラウンドで稼働しているLinphoneを通常のコマンドシェルから制御する場合に使用します。

$ linphonecsh
Usage:
linphonecsh <action> [arguments]
where action is one of
	init		: spawn a linphonec daemon (first step to make other actions)
			followed by the arguments sent to linphonec
	generic	: sends a generic command to the running linphonec daemon
			followed by the generic command surrounded by quotes,
			 for example "call sip:[email protected]"
	register	: register; arguments are 
			--host <host>
			--username <username>
			--password <password>
	unregister: unregister
	dial		: dial <sip uri or number>
	status	: can be 'status register', 'status autoanswer' or 'status hook'
	soundcard: can be 'soundcard capture', 'soundcard playback', 'soundcard ring',
			 followed by an optional number representing the index of the soundcard,
			 in which case the soundcard is set instead of just read.
	exit		: make the linphonec daemon to exit.

ユーザ認証する場合

$ linphonecsh generic "register sip:[email protected] sip.linphone.org user100_password"

バックグラウンドで動作しているlinphoneを停止

$ linphonecsh exit

設定ファイルを指定してバックグラウンド(デーモン)起動

$ linphonecsh init -c /home/user/.linphonerc

ステータス確認

$ linphonecsh status register
registered, identity=sip:[email protected] duration=3600

本家Linphone - Belledonne Communications提供のSIPサーバは頻繁にアップデートしているためか、現在デフォルトのTLS接続によるユーザ認証ができない不具合が発生しているようです。
UDP,TCP接続による認証は通るので、一度linphoneを停止、UDP,TCPポートの設定を追加して再起動します。

Linphoneデーモン停止

$ linphonecsh exit

設定ファイル .linphonerc 内 [sip] セクションに以下追加

$ nano /home/xxx/.linphonerc
[sip]
.....
.....
sip_port=5060
sip_tcp_port=5061
sip_tls_port=0
.....
.....

Linphoneデーモン再起動

$ linphonecsh init -c /home/user/.linphonerc

linphonecshコマンドの使用例

動作中のLinphoneの設定を $ linphonecsh generic " ~ " コマンドで行います。(呼出音のディレクトリは手動で.linphonercで指定する必要があるようです)。

コマンド一覧

$ linphonecsh generic "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.

拡張コマンド

$ linphonecsh generic "help advanced"
Advanced commands are:
---------------------------
               codec	Audio codec configuration
              vcodec	Video codec configuration
                  ec	Echo cancellation
                  el	Echo limiter
 nortp-on-audio-mute	Set the rtp_no_xmit_on_audio_mute configuration parameter
             vwindow	Control video display window
             pwindow	Control local camera video display (preview window)
            snapshot	Take a snapshot of currently received video stream
    preview-snapshot	Take a snapshot of currently captured video stream
              vfureq	Request the other side to send VFU for the current call
              states	Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions
            register	Register in one line to a proxy
          unregister	Unregister from default proxy
              status	Print various status information
               ports	Network ports configuration
               param	parameter set or read as normally given in .linphonerc
               speak	Speak a sentence using espeak TTS engine
           staticpic	Manage static pictures when nowebcam
            identify	Returns the user-agent string of far end
            ringback	Specifies a ringback tone to be played to remote end during incoming calls
            redirect	Redirect an incoming call
   zrtp-set-verified	Set ZRTP SAS verified.
 zrtp-set-unverified	Set ZRTP SAS not verified.
---------------------------
Type 'help <command>' for more details.