Free Landline Using Google Voice and a RaspberryPi




Introduction: Free Landline Using Google Voice and a RaspberryPi

About: DIY home automation enthusiast.

Disclaimer: The following article is intended for users comfortable working on Linux based machines.

In this article I'll review the steps I used to configure a VoIP landline using a SIP interface through a Raspberry Pi based PBX with Freeswitch and Google Voice.  In other words, a free landline!

I spent the better part of the weekend reading wiki's, blogs, manuals and other posts and had to piece them all together to get my own personal solution working.  I thought it would be useful to write it up and share my experiences.

I've tried to capture my steps as best as I could .  Please let me know if anything does not work or needs to be amended.

NOTE: You do not have 911 capability with this solution.

Step 1: Things You'll Need

    - A Raspberry PI with "wheezy-raspbian" connected to your network.  Please see the Raspberry Pi Wiki for instructions on how to set this up.
    - A physical SIP device or software, like XLITE.  I'm using an old Sipura SPA-2100.  One end connected to your physical phone line and the other to your network.  If you decide to use a software solution, like XLITE, then this isn't a "true" landline replacement because you'll need your PC always on.  Using a SIP device, allows
    - A Google voice account.

     - Test your Google voice account, try calling a number from the web UI.

      Then log into Google Voice:
     -   Click on Settings > Phones
     -   Uncheck all phones
     -   Check Google Chat
     -   Log out of gmail ( Or turn off chat at the bottom of the gmail page)

Step 2: Get Started

Install dependencies on your Raspberry pi.

    #apt-get install autoconf automake gawk g++ git-core libjpeg62-dev libncurses5-dev libtool make python-dev gawk pkg-config libtiff4-dev libperl-dev libgdbm-dev libdb-dev libssl-dev

Download, Compile and install freeswitch. NOTE: This step takes a few hours to compile. 

    #mkdir /usr/local/freeswitch
    #useradd freeswitch -d /usr/local/freeswitch
    #chown -R freeswitch:freeswitch /usr/local/freeswitch

    #cd /usr/local/src
    #git clone git://
    #cd /usr/local/src/freeswitch

    #./ && ./configure --prefix=/usr/local/freeswitch && make clean && make clean modwipe && make && make install

    Make sure the following line is present and uncommented in /usr/src/freeswitch/modules.conf


    And build mod_dingaling:

    #make mod_dingaling-install

Make sure mod_dingaling is not commented out in file conf/autoload_configs/modules.conf.xml

     <load module="mod_dingaling"/>

Edit the conf/jingle_profiles/client.xml and replace all its contents with the following.  Then replace only the highlighted fields with your Gmail username and password.

      <!-- Client Profile (Original mode) -->
      <!-- to use this profile take the x- away from the open and close tags so its <profile> and </profile> -->
      <profile type="client">
        <param name="name" value="gtalk"/>
        <param name="login" value=""/>
        <param name="password" value="GMAIL.PASSWORD"/>
        <param name="server" value="" />
        <param name="message" value="Thanks Google!" />
        <param name="dialplan" value="XML"/>
        <param name="context" value="default"/>
        <param name="exten" value="2001"/>
        <param name="rtp-ip" value="auto"/>
        <param name="auto-login" value="true"/>
        <param name="sasl" value="plain"/>
        <param name="server" value=""/>
        <param name="tls" value="true"/>
        <param name="use-rtp-timer" value="false"/>
        <param name="vad" value="none"/>
        <param name="candidate-acl" value=""/>
        <param name="local-network-acl" value=""/>


Step 3: Start Freeswitch

Start freeswitch manually and test module


You should get a console like in the picture .

Try running reload mod_dingaling  if you entered the correct credentials and all was compiled
correctly, you should see the following message:

+OK Reloading XML
+OK module unloaded
+OK module loaded

freeswitch@pbx> 2012-12-30 19:52:59.136376 [NOTICE] libdingaling.c:1674 XMPP server connected

2012-12-30 19:52:59.356369 [NOTICE] libdingaling.c:1686 XMPP authenticated

Exit the freeswitch console using the shutdown command, and return to the shell prompt.

Edit the conf/directory/default.xml and replace all its contents with the following.  Then replace  only the highlighted fields with your SIP device IP address

      <!--the domain or ip (the right hand side of the @ in the addr-->
      <domain name="192.168.0.XXX">
          <param name="dial-string" value="{^^:sip_invite_domain=${dialed_domain}:presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(*/${dialed_user}@${dialed_domain})}"/>

          <variable name="record_stereo" value="true"/>
          <variable name="default_gateway" value="$${default_provider}"/>
          <variable name="default_areacode" value="$${default_areacode}"/>
          <variable name="transfer_fallback_extension" value="operator"/>

          <group name="public">
              <X-PRE-PROCESS cmd="include" data="default/*.xml"/>


Create a file called conf/directory/default/2001.xml and paste the following contents, replacing only the highlighted fields with any random password (save it for later) and your name, which will be used for caller id.

      <user id="2001">
          <param name="password" value="MAKEUPONE"/>
          <param name="vm-password" value="1000"/>
          <variable name="toll_allow" value="domestic,international,local"/>
          <variable name="user_context" value="default"/>
          <variable name="effective_caller_id_name" value="John Doe"/>
          <variable name="effective_caller_id_number" value="2001"/>
          <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
          <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
          <variable name="callgroup" value="default"/>

Step 4: Configure Your SIP Device

Login to your SIP (Or SIP software), and enter the following . (NOTE I will only demonstrate on the SPA-2100, other solutions will have different screens).   NOTE: your configuration page may vary based on your SIP solution.

    In the proxy (or domain) type in the IP address or hostname of your freeswitch PBX.
    The Display Name can be anything you want.
    User ID should be 2001 (because that is what I set it to).
    The passowrd  is from the one you made up above.

Start freeswitch on the command line /usr/local/freeswitch/bin/freeswitch
    Save and reboot the SIP device.  You SIP device should now be registered. You can test by way of hearing a dial tone on your phone.
    Open another login window to your PBX and leave the previous freeswitch console open in the the other window. We'll reference it later.
    Edit the conf/dialp/default.xml and add the following, right after the "unloop" extension section.  Then replace only the highlighted fields with your SIP device IP address.

         <extension name="gvoice_in">
          <condition field="source" expression="^mod_dingaling$">
            <!--<action application="info" />-->
            <action application="log" data="CONSOLE GV CALL IN!" />
            <action application="log" data="CONSOLE ${destination_number}"/>
            <action application="start_dtmf" />
            <action application="set" data="execute_on_answer=send_dtmf 1@2001"/>
            <!--<action application="cidlookup" data="$1"/>-->
            <action application="set" data="hangup_after_bridge=true" />
            <!--<action application="set" data="originate_continue_on_timeout=true"/>-->
            <!--<action application="set" data="call_timeout=35"/>-->
            <action application="bridge" data="user/2001@192.168.0.XXX"/>
            <action application="answer"/>

        <extension name="gvoice_out">
          <condition regex="any">
            <regex field="destination_number" expression="^(\d{10})$" />
            <regex field="dialed_extension" expression="^\+1(\d{10})$" />
            <regex field="destination_number" expression="\+1(\d{10})$" />
            <action application="set" data="hangup_after_bridge=true"/>
            <action application="set" data="ringback=${us-ring}"/>
            <action application="set" data="call_timeout=45" />
            <action application="ring_ready"/>
            <action application="bridge" data="dingaling/gtalk/+1$"/>

    Edit the conf/autoload_configs/dingaling.conf.xml and replace all its contents with the following.

        <configuration name="dingaling.conf" description="XMPP Jingle Endpoint">
            <param name="debug" value="0"/>
            <param name="codec-prefs" value="PCMU"/>

          <X-PRE-PROCESS cmd="include" data="../jingle_profiles/*.xml"/>


    Go back to the freeswitch console window and type reloadxml  then  reload mod_dingaling
    Now you are can test making outgoing and receiving calls.
    If all works to your satisfaction, its time to make freespace start automatically at boot time.

Creating a Freeswitch boot service

    Create a new file called /etc/init.d/freeswitch paste the contents from this file.

#chown -R freeswitch:freeswitch /etc/init.d/freeswitch

#chmod +x /etc/init.d/freeswitch

#update-rc.d  freeswitch defaults

#/etc/init.d/freeswitch start

    Reboot the pbx and check that the daemon started successfully and that everything is working.

Voice Codec Optimization (Optional)
I found that the default codec causes outgoing calls to be choppy.  To fix this, I changed the default codec to PCMA.

Replace the following in conf/vars.xml

<X-PRE-PROCESS cmd="set" data="global_codec_prefs=G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,GSM"/>

with the following

<X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMA"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMA"/>

Save the file and stop and start the service

#service freeswitch stop  && sleep 15 && service freeswitch start

freeswitch startup script

# Start/stop the freeswitch daemon.
# Provides:          freeswitch
# Required-Start:    $network
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:  0 1 6
# Short-Description:
# Description:


test -f $DAEMON || exit 0

. /lib/lsb/init-functions

# there because it should be in /etc/default/locale.
parse_environment ()
    for ENV_FILE in /etc/environment /etc/default/locale; do
        [ -r "$ENV_FILE" ] || continue
        [ -s "$ENV_FILE" ] || continue

         for var in LANG LANGUAGE LC_ALL LC_CTYPE; do
             value=`egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2`
             [ -n "$value" ] && eval export $var=$value

             if [ -n "$value" ] && [ "$ENV_FILE" = /etc/environment ]; then
                 log_warning_msg "/etc/environment has been deprecated for locale information; use /etc/default/locale for $var=$value instead"

# Get the timezone set.
    if [ -z "$TZ" -a -e /etc/timezone ]; then
        TZ=`cat /etc/timezone`

# Parse the system's environment
if [ "$READ_ENV" = "yes" ] ; then

case "$1" in
start)  log_daemon_msg "Starting freeswitch " "freeswitch"
        ulimit -s 240
        OLDPID=`pgrep $NAME`
        NEWPID=`cat $PIDFILE` 2>/dev/null
        if [ "$OLDPID" =  "$NEWPID" ] ; then
                echo "Service already running " && exit 1
                su - $NAME -c "$DAEMON $DARGS " >/dev/null 2>&1
        sleep 1
        ps -ef|grep $DAEMON|grep -v grep|awk '{print$2}' > $PIDFILE
        log_end_msg $?
stop)   log_daemon_msg "Stopping freeswitch" "freeswitch"
        kill `cat $PIDFILE` >/dev/null 2>&1
        [ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
        log_end_msg $RETVAL
restart) log_daemon_msg "Restarting freeswitch" "freeswitch"
        $0 stop
        $0 start
        log_end_msg 0
        status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
*)      log_action_msg "Usage: /etc/init.d/freeswitch {start|stop|status|restart|reload|force-reload}"
        exit 2
exit 0

Be the First to Share


    • Home and Garden Contest

      Home and Garden Contest
    • Electronics Contest

      Electronics Contest
    • Origami Speed Challenge

      Origami Speed Challenge



    5 years ago

    X-Lite no longer supports linux! It still supports Windows and Mac. However, the page at says you can use Ekiga on Linux!


    5 years ago

    Obi 200 is a $39-$49 Google Voice to POT bridge that does this same thing. It takes about 10 min or less to setup up new google account and install OBi. Thats less than the cost of a pi and power supply and cable.


    Reply 5 years ago

    I am considering this because Obi charges $10/year subscription fee. They don't tell you this when you by the product, but after 1 year it stops working and they don't provide the information on how to correctly configure it unless you pay $10/year. So it would be nice to build your own and eliminate any third party between the device and Google Voice.


    Reply 5 years ago

    Obi doesn't technically charge a subscription fee nor for the firmware update, but does charge for the annual warranty (see here:

    It is however, a pain to go through switching to a LAN connection to get into the Obi's web client and update the firmware. The firmware is available for free (see here:

    Paying the $10 for a year's worth of support and less than 5 minutes in firmware update time is less then the amount I spent trying to update it manually.


    Reply 5 years ago

    I have 2 obi200's and an obi202 setup with google voice and obitalk thats been working flawlessly for almost 2 years now and Ive never paid for any subscription! One of the obi200's got hit by lightning about a year ago and the sent me an advanced replacement for free. I dont think that would of changed the "1year limit" for all 3 obi's


    5 years ago

    are some great points and loads of information about my desired issue and I
    liked 0800 call forwarding because
    they have proved themselves really helpful by getting me the result I wanted!


    7 years ago on Step 4

    Any hints con how to hook up a speaker + mic to RPi to make VOIP calls, without needing a PBX on it? Skype would be great (but impossible?) Google Voice an option.


    6 years ago on Introduction

    Rather than buying a Pi and also a SIP device you achieve the same using the following device

    I have a couple of these and I just connect a standard cordless phone to the RJ11 and I have a free landline anywhere in the house. This is plug and play


    7 years ago on Introduction

    I ran into another issue

    root@pi:/usr/local/src# git clone git://
    Cloning into 'freeswitch'...
    fatal: unable to connect to[0:]: errno=Connection refused

    A little research and I found this
    Stash not git: The git repository has been replaced by Stash. See the Makefile scripts for CentOS or Debian or the Developers page under Community for specifics.
    A little more research and I found this
    apt-get install autoconf automake devscripts gawk g++ git-core libjpeg-dev libncurses5-dev libtool make python-dev gawk pkg-config libtiff5-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev
    cd /usr/src

    # To build from Master, the latest source code:
    git clone
    ##### OR #####
    # To build from the current release source code:
    git clone -b v1.4
    cd /usr/src/freeswitch
    # The -j argument spawns multiple threads to speed the build process
    ./ -j
    # if you want to add or remove modules from the build, edit modules.conf
    vi modules.conf
    # add a module by removing '#' comment character at the beginning of the line
    # remove a module by adding the '#' comment character at the beginning of the line containing the name of the module to be skipped
    ./configure --enable-core-pgsql-support
    make && make install

    I notice that they didnt install libjpeg62-dev or libtiff4-dev. Mater of fact, they install libtiff5-dev along with a few others. I am speculating that the current release is higher than the one that you prepared in this instructable, along with the possibility that some modules left uncommitted wont need some of the extra packages. Bit I doubt that installing them anyways would be a problem.

    I will follow the instructions as provided on the page for version 1.4 and merge them with your instructions "#./ && ./configure --prefix=/usr/local/freeswitch && make clean && make clean modwipe && make && make install" as well as un-commenting
    "endpoints/mod_dingaling" in /usr/local/src/freeswitch/modules.conf rather then /usr/src/freeswitch/modules.conf because the path you provide was not consistent with your prior instructions "cd /usr/local/src ; git clone git://". I will respond back later with how well this work or not.


    Reply 7 years ago on Introduction

    I have been busy with life, and have not yet completed mine, but I will try as best I can. At what stage are you having a problem?


    7 years ago on Introduction

    Starting with a fresh system and after running
    # apt-get update
    # apt-get upgrade
    and then running
    # apt-get install autoconf automake gawk g++ git-core libjpeg62-dev libncurses5-dev libtool make python-dev gawk pkg-config libtiff4-dev libperl-dev libgdbm-dev libdb-dev libssl-dev

    I get a bunch of "... is already the newest version"

    and ended with
    Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.

    The following information may help to resolve the situation:
    The following packages have unmet dependencies: libtiff4-dev : Depends: libjpeg-dev

    E: Unable to correct problems, you have held broken packages.

    I proceeded to apt-get install each one at a time and then came to libtiff4-dev that apparently doesn't work with libjpeg62-dev

    # apt-get install libtiff4-dev
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed: libjbig-dev libjpeg8-dev libtiffxx0c2
    The following packages will be REMOVED: libjpeg62-dev
    The following NEW packages will be installed: libjbig-dev libjpeg8-dev libtiff4-dev libtiffxx0c2
    0 upgraded, 4 newly installed, 1 to remove and 0 not upgraded.
    Need to get 633 kB of archives.
    After this operation, 985 kB of additional disk space will be used.
    Do you want to continue [Y/n]?

    I selected Y and proceeded with the rest of the apt-get installs. I will get back to share if it works or not.


    7 years ago on Step 4

    Any hints con how to hook up a speaker + mic to RPi to make VOIP calls, without needing a PBX on it? Skype would be great (but impossible?) Google Voice an option.


    Will this work following the discontinued support for XMPP by google voice?


    7 years ago on Introduction

    Does this solution allow for incoming calls for free as well?


    Which wheezy-raspbian image did you use to build this? What release date?