SIP-Client for Raspberry Pi that works from comman

2019-01-22 16:00发布

i want to use my raspberry pi as a SIP/VOIP-Phone, just controlling the RPI via SSH.

I found some tutorials and it seems that Twinkle is one of the most useful apps for that.

So i successfully installed twinkle on my RPI, one SPI-Client on my Android-Phone and for know i am able to send text messages from one to another.

The thing is: I have to use the Twinkel GUI with X-Server-forwarding (currently using MacOS with X11 and iTerm).

But i kind of want to automate the whole process, like using twinkle from command line, controll it with scripts etc.

So, obviously twinkle is not made for that. (there dont even is a documentation for the account-config-file, so i had to struggle through that x11-forwarding-stuff)

So, my final question is: Is there comparable SIP-client for the RPI that can be controlled via CLI?

any hint is highly appreciated. While googling this question i just found projects working with asterisk-server on the RPI or attaching displays to it - but thats not what i am looking for...

cheers and thanks

5条回答
你好瞎i
2楼-- · 2019-01-22 16:10

Controlling the Ring (formerly SFLPhone) daemon with a Python script:

  1. Build the Ring daemon:

  2. Run the Ring daemon: ./bin/dring -c -d. You should see Ring running with some logs. The first option -c will print the logs to the console (stdout/stderr) and -d will enable debug logs.

  3. Run the D-Bus python3 controller :

    • Open a new terminal to ring/tools/dringctrl, while keeping the daemon running.
    • Try to list configured accounts with : ./dringctrl.py --gara. If everything worked, you should at least see "IP2IP", the default account that handles direct IP to IP SIP calls.
    • Try to call another SIP endpoint with ./dringctrl.py --call someIP.
    • Run ./dringctrl.py --help to see currently implemented commands in the python script.
  4. Configure Ring and change the python script to fit your needs

    • Unfortunately, adding/configuring accounts from the python script is not implemented yet (it would be possible though). Account configuration is stored in /home/$USER/.config/ring/dring.yml . If you plan to have a static configuration, you could edit the configuration file once manually or using one of the available GUIs, possibly from another computer then copying the file (on a desktop just install official packages: http://ring.cx/en/documentation/gnulinux-installation ).
查看更多
Bombasti
3楼-- · 2019-01-22 16:19

you want "to use your raspberry pi as a SIP/VOIP-Phone, just controlling the RPI via SSH"?

the best and simplest solution IMHO is:

just use asterisk itself and its ingenious console interface + an USB Headset (e.g. Logitech H800 Headset) for that!

The H800 shows up as a conventional sound card being accessed directly by asterisk's 'chan_alsa' channel module. That's it!

This gives me excellent audio quality and a pure console interface with the unsurpassed capabilities of asterisk. Entirely lacking the annoyance of any GUI. All running on a raspberry. Asterisk and 'chan_alsa' (or even 'chan_oss') is integral part of all major distributions.

Optionally you can make the whole thing completely wireless by using a WLAN dongle in the remaining USB port.

查看更多
一夜七次
4楼-- · 2019-01-22 16:21

I am doing the same thing and I came across additional options so far:

  1. Linphone: Easy to install but I fail to make phone calls
    RaspberryPI: Making SIP outbound calls using linphonec or an alternative SIP soft phone

  2. Ring (formerly SFLphone): Looks promising but needs to be installed from source
    Installing the "ring.cx SIP client" on a Raspberry PI.
    Update: Also check out @aberaud's answer below

  3. PJSIP (C Library)

Twinkle CLI

From the SFLphone mailing list I got this feedback, which might help you:

I'm interests to known if the project write something for that. By the pass, I used Twinkle SIP client that permit to pass command to an already launched processus that permit for instance to answer an incoming call. It was really cool and permit me to map some keyboard shortcuts to control my phone without to switch desktop and find the good windows.

After some search, I'm found some old scripts that permit to control old versions of sflphone by using it's DBUS API. Inspire by this scripts, I wrote my own, compatible with the version of sflphone I used (1.4.1 in Debian Wheezy) :

https://gitlab.com/brenard/sflphone-ctl

It's work weel and I'm use it every day. Call transfer does not work on my desktop but it seam to be a bug on version 1.4.1 of sflphone.

B. R.

BTW: twinkle --help shows the following:

--cmd <cli command>
    Instruct Twinkle to execute the CLI command. You can run
    all commands from the command line interface mode.
    When Twinkle is already running, this will instruct the running
    process to execute the CLI command.

    Examples:
    twinkle --cmd answer
    twinkle --cmd mute
    twinkle --cmd 'transfer 12345'

I had no luck so far myself but I really want to get this to work too.

查看更多
仙女界的扛把子
5楼-- · 2019-01-22 16:23

Best VOIP client for Raspbery Pi in my experience is Twinkle.

 sudo apt-get install twinkle 

Use the app to create a profile (i.e. setup the account) and name it twinkle (all lower case). This gets saved to

/home/pi/.twinkle/twinkle.conf

The below command will take you into a Twinkle’s command processing prompt.

$ twinkle -c 
Twinkle> call +17601234567

Twinkle> bye

Twinkle> quit 

$

Here is the python script that should help you to do command line:

import sys
from subprocess import Popen, PIPE

proc = Popen(["twinkle", "-c"], stdin=PIPE, stdout=PIPE, bufsize=1)

for line in iter(proc.stdout.readline, b''):
    print line
    if (line.find("registration succeeded") > 0):
        proc.stdin.write("call +17601234567\n")
    #do whatever you want by adding code...
    if (line.find("far end answered call") > 0):
        proc.stdin.write("bye\n")
        proc.stdin.write("quit\n")
proc.communicate()
查看更多
狗以群分
6楼-- · 2019-01-22 16:33

What i get so far:

I am using the RasPi B+ with Raspbian OS.

What i tried so far: Twinkle (install with sudo apt-get install twinkle)

When its configured, you can use it via CLI, but unfortunately I wasnt able to configure Twinkle via command line. I had to configure X-Forwarding for my Mac. I installed X11 (resp. XQuartz) for Mac. So i was able to see the GUI and configure Twinkle.

What did work: I was able to send messages, but when a call came in, Twinkle crashed. I have to state out, currently there is no sound devices installed (no mic, no speakers).

After that I searched for SFL Phone. This does not come with a CLI. So its not worth testing it.

I also read about Linphone. Currently I did not tried it, because some people report about difficulties to use it in own applications.

The last thing I found is PJSIP.

I installed it like that:

sudo su - 
apt-get install subversion
svn checkout http://svn.pjsip.org/repos/pjproject/trunk
apt-get install build-essential automake autoconf libtool libasound2-dev libpulse-dev libssl-dev libsamplerate0-dev libcommoncpp2-dev libccrtp-dev libzrtpcpp-dev libdbus-1-dev libdbus-c++-dev libyaml-dev libpcre3-dev libgsm1-dev libspeex-dev libspeexdsp-dev libcelt-dev
cd trunk
./configure && make dep && make clean && make && make install

This took a while and is has a decent CLI. I was able to send and receive calls. For now I am waiting for my USB-Soundcard, a microphone and some speakers to do some full testing.

查看更多
登录 后发表回答