Linphonec systemd setup
The original task was running linphonec (console version of Linphone) automatically
on system startup and manage it from other application later.
There were several problems. Not unique, google finds same questions. But none is answered :)
PS. originally, it was about Linux, but there are some similar problems with Windows too.
- SIP autoregister works sometimes
- sound card works under GUI but doesn't work in console version.
- sound card is not always detected properly when running console or daemon version.
- systemd doesn't start linphonec in any documented way
SIP autoregister depends on proper config (with password specified) and proper path to config.
Config search alorithm is environment-dependent.
Use -c /path/to/.linphonerc explicitly and force run under proper user (use sudo -u).
Under Windpows config file is placed at \Users\UserName\AppData\Local\linphone\linphonerc.
Note, it has no dot character in filename.
You can generate config from GUI, find it and specify path explicitly with -c (GUI and CLI configs may differ!).
You can run linphonec and use proxy add command.
You can update .linphonerc manually.
Note: username is auth. user for remote server. reg_identity *** and userid are your number (extension in asterisk terms),
it often may, but not must be equal to username, ask provider/sysadmin if not sure.
reg_identity - how local phone identifies itself for incoming calls, userid - how to represent itself for outgoing calls (may differ if server allows).
Sound card issues
Sound problem appeared to be build-dependent and environment-dependent.
Some builds of linphonec didn't work with soundcard, however GUI linphone worked fine.
Setting any visible card from concole (sound list, sound use) doesn't help. Just try another build in this case.
Config search algorithm is environment-dependent, access to sound card may be too.
So it is better to
use -c /path/to/.linphonerc explicitly and force run under proper user (use sudo -u).
Linux Systemd support
Systemd assumes that executable is started and not exited/forked.
Thus, linphonecsh init will now work. Because linphonecsh
runs linphonec as separate process and exits. Then systemd kills entire process tree.
Run linphonecsh init (may be with some other switches, e.g. for autoanswer or register) and see in
process list (ps axwwu) what exact command line and user are used. You will see undocumented
option --pipe which instructs linphonec to listen to commands on pipe instead of standard console.
linphonecsh uses this pipe for sending commands to lin phonec running as daemon.
Also, some other undocumented option -C is used. This would be proper command line for running from systemd.
Description = Start linphone daemon
ExecStart=/usr/bin/linphonec --pipe -C -c /home/your_local_user/.linphonerc
Windows backgound operation (daemon-like) support
Often problem - linphonec works fine, but linphonecsh can't start linphone in proper environment (like under Linux ;),
it can't register, init sound or dial for some reason. Proper solution is running linphoned - special windows-specific executable
for running as daemon in background with explicit config file specification. Actually, linphonecsh just runs it on init.
Note: -C is essential too.
linphoned.exe --pipe -C -c C:\Users\UserName\AppData\Local\linphone\linphonerc
You can check if it is running via task manager or from console with wkill.exe
wkill.exe -l -N "linphoned"
or mail alterX@alter.org.ua (remove X)