Asterisk + FreePBX + Google Voice on DNS-323

15 Comments

It’s totally possible to receive and make calls using your Google Voice number for free! Basically we will setup a PBX server with Asterisk and FreePBX, and Sipgate.com provides unlimited free inbound calls. Here is how it works, quoting Nerd Vittles:

For outbound calls, we’ll combine a little dialplan voodoo with pygooglevoice to instruct Asterisk to place a click-to-dial call using your Google Voice forwarding number. Then we’ll stuff in the destination U.S. phone number. When you dial GV-678-1234567 from any of your Asterisk phones, Asterisk will park your initial call in a reserved parking lot slot and then join the called party to the originally parked call. The entire procedure is virtually transparent both to the caller and the callee. And, unlike the MeetMe conference, the parking lot fades out of the picture as soon as the call is connected. Thus, if either party hangs up, the active channel for the call is terminated on your Asterisk server.

For inbound calls from your Google Voice number, we’ll tweak the dialplan so that it can distinguish between a RingBack call that Google Voice initiated and a true inbound call. We’ll peel off the real inbound calls and route them to a separate Inbound Route in FreePBX for processing in any way you desire.

With this method, you can make free calls on your smartphone whenever these is reasonable Wi-fi or 3G connections available. Or you can set up a SIP phone or connect a regular phone to an Analog Telephony Adapter at home and uses your Google Voice number. A free land line. You can also forward your calls from Google Voice to both your cell phone and the SIP home phone, when you are at home, you can pick up the home phone instead to save cell phone minutes.

Here is a comprehensive guide to how to set up Asterisk and FreePBX along with Google Voice in order to make and receive calls for free on your DNS-323. I did not come up with all these, but learned from various sites. The credits go to them. I just put them together specifically for DNS-323 users.

Before we start, I assume that you:

  • Have a brand new DNS-323 on firmware 1.5 or 1.6 with fun_plug enabled and have SSH access. If not, follow this guide first.
  • Basic Linux knowledge and comfortable with command line interface (CLI).
  • Have a Google Voice Account. If you don’t have one yet, request an invite here or ask those who have one to invite you.
  • Have a SipGate account. Sign up here, it’s free. Make sure you write down the SIP Credentials in Settings.
  • Forward your calls in Google Voice to your SipGate number.

It’s much easier to do this on a regular computer/server than on DNS-323, which involves many extra steps. On a regular computer you can simply install PBX In A Flash with minimal effort. But our frugal motto makes us squeeze out every drop of juice out of DNS-323 for our money’s worth.

Step 0. Clean Up DNS-323

First of all, we need to stop all unnecessary services on DNS-323. Of course you can leave them all if you have to use them, but it’s recommended to stop what you don’t need.  If you run too many programs on DNS-323, it will have to use swap frequently. Then you hard drive will never spin down, not good.

  1. Stop uPNP server.
  2. Stop iTunes Media server. You can install FireFly later on on Debian.
  3. Remove the built-in Bittorrent client. Simply delete the folder “/mnt/HD_a2/Nas_Prog/BT“. You can install rTorrent on it and start it whenever you need to instead of having a daemon always on. You can install rTorrent later on on Debian.

Step 1. Install Debian Lenny on DNS-323

  1. Download http://mesh.dl.sourceforge.net/sourceforge/debnas/debnas-0.5.tar.bz2
  2. Extract the two files “fun_plug” and “linux.tar” to the root directory of your DNS-323 volume.
  3. Reboot DNS-323
  4. Wait for a few minutes

You should be able to access DNS-323 via SSH. Username root, default password is 12345678. Make sure you change it! Now we are going to upgrade all the packages to the latest version.

First we need to edit the repository file: /etc/apt/sources.list.d/etch.list and replace the word “etch” with “lenny“. Save and  go back to command prompt:

dlink-xxxx:# apt-get update
dlink-xxxx:# apt-get dist-upgrade

Debian is now installed.

Credit for this part goes to Mike Gore and Manuel Treitinger.

Pages: 1 2 3 4 5 6

RSSSubscribe to the RSS feed to receive more useful tips. Filed under: Hardware,How-To,Software

15 Responses to “Asterisk + FreePBX + Google Voice on DNS-323”

  1. John Timmers
    January 15th, 2010 at 6:35 AM

    Wow, great tutorial! Makes it really clear, the steps you’ve taken. It’s actually deterred me from doing it on my own dns-323, which I’m using primarily now, as a torrent client/server ( I was using it a a backup/fileserver for our home computer network, but realized pretty quickly it just didn’t have the horsepower to do what I wanted it to do). That said, it’s as reliable as a hammer, in that it will run for months without a hiccup (installed funplug on it almost immediately after unboxing it a couple years ago).

    After reading about your experiences, and the instructions on the nerdvittles site, I think I’m going to buy one of those low power acer revo boxes, and install pbx-in-a-flash on it. I think they have enough power to do what you’ve done on the dns-323, and media-centre as well :-) :-)

    Thanks again for the writeup!

  2. rolandli
    January 15th, 2010 at 8:36 AM

    Thanks. But this is not something original, I just put those pieces together specifically for DNS-323.

    I use my DNS-323 mostly as a media server, occasionally for Bittorrent. But the built-in BT client is very limited and crashes often. So I siwtched to rTorrent. I can turn it on and off as I wish.

    The Acer Revo is a great machine. It’s cheap, even cheaper if you go the Ubuntu route. I was considering getting one as a HTPC. But I do want Blu-Ray capability and Atom is just not gonna cut it.

    D-Link has a 4-Bay NAS DNS-343, that maybe my next NAS since the 2TB on my DNS-323 is running out soon…

  3. turuncuoglu
    April 18th, 2010 at 8:44 AM

    Thanks for this great tutorial. I am very interested in running the pbx on the dns 323. If i install the debian can I still use the original firmware etc?

    Thanks for the help

  4. rolandli
    April 18th, 2010 at 1:18 PM

    Glad it helps. The Debian installed on DNS-323 is basically a chroot environment. So all the basic functions are still being done by the original firmware. Such as the Samba, Web UI and BT clients (although the BT client from the firmware is not very good quality).

  5. turuncuoglu
    April 20th, 2010 at 8:23 AM

    I have been using the guide.

    On the following line it can not find mysql and php5
    dlink-xxx:# apt-get install lighttpd mysql php5 php-pear php-mysql python python-setuptools

    and modules.conf for asterisks did not have the following lines

    load => format_au.so

    load => format_mp3.so

    I am not sure how important these are. I will let you know if i can get it working.

    Thanks for a great write up.
    t

  6. rolandli
    April 20th, 2010 at 8:34 AM

    Hum, it’s weird you can’t apt-get mysql and php5. Those are vital ingredients.

    Regarding modules.conf, just add those lines in there.

  7. turuncuoglu
    April 20th, 2010 at 10:41 AM

    Actually I found that mysql is called mysql-server and php5 is php5-mysql then it installed it all
    but i had an issue with lighttpd
    it does not start the server i got the following error

    lighttpd.conf line: 158 pos: 1 parser failed somehow near here: (EOL)

    have you seen anything like this. line 158 is the last line and it does not like a character there.

  8. turuncuoglu
    April 20th, 2010 at 2:15 PM

    Actually would it be possible to copy your ligthtpd.conf file here?

  9. rolandli
    April 21st, 2010 at 8:00 AM

    I just sent it to your Gmail.

  10. turuncuoglu
    April 21st, 2010 at 1:23 PM

    Thanks
    Actually I have got it working last night but it was not easy. There is a problem with the fastcgi.conf file =>
    should be >.

    It is not working and I had to do alot trouble shooting. If you are interested in updating your guide let me know.

    t

  11. twinclouds
    July 8th, 2010 at 3:16 PM

    Hi,
    I am thinking about to implement GV through FreePBX on Sheevaplug. Since FreePBX is already available on the Plug with PlugPBX, do you think it is possible to make it work following the procedure given on Page 5?

  12. rolandli
    July 9th, 2010 at 8:24 AM

    I am not familiar with PlugPBX, but I would think it’s a similar process.

  13. twinclouds
    July 15th, 2010 at 2:59 PM

    Hi, Roland:
    Thank you for your good tutorial and guide. I followed it to install FreePBX on my MSSII NAS box. It installed Debian pretty well. I also installed Asterisk successfully. The problem is that that when I install FreePBX, there were some error message for the command: “mysql asteriskcdrdb < SQL/cdr_mysql_table.sql” (Page 4)
    It says: ”
    sh: lt: command not found
    sh: SQL/cdr_mysql_table.sql: No such file or directory
    sh-3.2# ERROR 1049 (42000): Unknown database ‘asteriskcdrdb’

    Can you provide some ideas to fix this problem? Thanks in advance.

  14. rolandli
    July 15th, 2010 at 3:05 PM

    First of all, all credits are due to the first people who wrote it. As I said in the post, I am just summarizing them =)

    I made a mistake there. It should be a “<“, less than symbol there. But when I was using the editor in WordPress, it converts it to HTML symbol “<”.

  15. twinclouds
    July 29th, 2010 at 3:28 PM

    Roland:
    Thanks.
    I can install everything now but have not make FreePBX work yet. I am busy with other projects so I will comeback to this later.
    As for the problem I have earlier, I found there was a typo in your script on Page 4. Namely:
    ………………
    dlink-xxx:# mysqladmin create asteriskcdrd
    dlink-xxx:# mysql asteriskcdrdb < SQL/cdr_mysql_table.sql
    ……………
    The a "b" was missing in "… create asteriskcdrd(b)". I was just cut and paste your script and missed the typo.
    Your tutorial is really very helpful. Thanks a lot for your effort.

Leave a comment