Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SIP-Client for Raspberry Pi that works from command line?

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

like image 262
n.r. Avatar asked Apr 03 '15 16:04

n.r.


People also ask

How do I access the Raspberry Pi from the command line?

Open Raspberry Pi Configuration (Menu > Preferences > Raspberry Pi Configuration). Change the Boot setting to 'To CLI' and click OK. Now when you reboot, you'll start in the command line (enter startx to boot into the desktop).

Is Raspbian a command line?

However, like all forms of Linux, Raspbian has a powerful command line interface that gives you a lot more control over the computer than you can get using the GUI.

Which command comes under Raspberry Pi terminal commands?

System Information Commandscat /proc/meminfo: Shows details about your memory. cat /proc/partitions: Shows the size and number of partitions on your SD card or hard drive. cat /proc/version: Shows you which version of the Raspberry Pi you are using. df -h: Shows information about the available disk space.


2 Answers

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)

    • Recommended by this tutorial
    • Compile and Install on Raspi
    • See http://www.pjsip.org

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.

like image 149
Besi Avatar answered Sep 16 '22 15:09

Besi


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()
like image 23
Steve Avatar answered Sep 19 '22 15:09

Steve