Google Voice for DD-WRT with Asterix integration

magicJack Tips and Tricks

Moderators: Bill Smith, Pilot

Post Reply
kingfisher1111
MagicJack Expert
Posts: 76
Joined: Tue Nov 27, 2007 6:17 pm

Google Voice for DD-WRT with Asterix integration

Post by kingfisher1111 »

Guys try this..

DD-WRT Installation
Install DD-WRT 2.4sp1 MEGA on your router

Enable JFFS:
1) Go to the Web Page-> Admin -> Enable JFFS
2) Click Apply
3) Wait a few seconds
4) Check Clean JFFS
5) Click SAVE (not apply)
6) Wait a few seconds
7) Reboot

Enable CIFS
Create a share on a server somewhere pc or linux box with samba
Mount the Share on DD-WRT in the Web interface
Admin->CIFS Automount
Enable
Fill in the parameters.
You can leave "Start Script" blank

Setup ipkg
Make a directory for ipkg (bug in dd-wrt)

Code:
mkdir -p /jffs/tmp/ipkg/lists
ipkg update
ipkg install kmod-loop
ipkg install kmod-ext2
insmod /jffs/lib/modules/2.4.30/loop.o
insmod /jffs/lib/modules/2.4.30/ext2.o
Do a lsmod to make sure ext2 and loop is loaded
If not, repeat the insmod commands above

Prep Partition File

1) create a file to make into an ext2 file system partition to be loop mounted

Code:
dd if=/dev/zero of=dd-wrt-opt.ext2 bs=1M count=200
* (where dd-wrt-opt.ext2 is the file and location mounted on your dd-wrt

2) Create a ext2 filesystem in the file you just created

Code:
echo y | mke2fs -L optware dd-wrt-opt.ext2
Mount the file as a loop filesystem

Code:
mount -o loop /tmp/smbshare/dd-wrt-opt.ext2 /opt
*remember to change /tmp/smbshare/dd-wrt-opt.ext to your path and file

Install Optware

Code:
wget http://www.3iii.dk/linux/optware/optwar ... l-ddwrt.sh -O - | tr -d '\r' > /tmp/optware-install.sh
sh /tmp/optware-install.sh
Install Asterisk

Code:
/opt/bin/ipkg-opt --tmp-dir /tmp install asterisk14
Install each or all of the following sets. Depending on what your ATA/softphone supports for codecs.

Code:
/opt/bin/ipkg-opt --tmp-dir /tmp install asterisk14-moh-freeplay-g729
/opt/bin/ipkg-opt --tmp-dir /tmp install asterisk14-core-sounds-en-g729
/opt/bin/ipkg-opt --tmp-dir /tmp install asterisk14-extra-sounds-en-g729

/opt/bin/ipkg-opt --tmp-dir /tmp install asterisk14-moh-freeplay-ulaw
/opt/bin/ipkg-opt --tmp-dir /tmp install asterisk14-core-sounds-en-ulaw
/opt/bin/ipkg-opt --tmp-dir /tmp install asterisk14-extra-sounds-en-ulaw
Install Python
Code:
/opt/bin/ipkg-opt --tmp-dir /tmp install python

Install Management Scripts

FIVN's collection of management scripts [fivn.com]. We are concerned with "3. Install Asterisk for DD-WRT"

Install optware startup scripts <-- Cut and paste the one I listed below using the web interface.
Install startup scripts
Install Asterisk Management script

Create a Startup Script:
From Web interface
Admin->Commands->Command Shell.
Paste into the box and click "Save Startup"
* if you have an existing script, you'll have to figure out how you want to incorporate

Code:
#!/bin/sh

insmod /jffs/lib/modules/2.4.30/loop.o
insmod /jffs/lib/modules/2.4.30/ext2.o
mount -o loop /tmp/smbshare/dd-wrt-opt.ext2 /opt

# Start all init scripts in /opt/etc/init.d
# executing them in numerical order.
#
for i in /opt/etc/init.d/S??* ; do

# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue

case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
Asterisk Startup scripts
Code:
Install startup scripts

mkdir -p /opt/etc/init.d
cd /opt/etc/init.d
wget http://www.fivn.com/scripts/S50asterisk
wget http://www.fivn.com/scripts/S51astadmin
chmod 755 S50asterisk S51astadmin
Install Asterisk Management script <-- Slightly modified. Use below instead

Code:
mkdir /opt/web
cd /opt/web
wget http://www.fivn.com/scripts/asterisk.sh
sed 's/operation_system_variant=""/operation_system_variant="dd-wrt"/' asterisk.sh > tmp
mv tmp asterisk.sh
chmod 755 asterisk.sh
Reboot

Asterisk Web Interface Location would be:
Code:
http://<router_address>/user/cgi-bin/asterisk.sh

Asterisk Configuration:

I cheated and just copied the files from a PiaF install on Virtualbox. Install and configure as normal.
Then copy the following files over to /opt/etc/asterisk

Code:
extensions.conf
extensions_additional.conf
extensions_custom.conf
extensions_override_freepbx.conf
features.conf
features_applicationmap_additional.conf
features_applicationmap_custom.conf
features_featuremap_additional.conf
features_featuremap_custom.conf
features_general_additional.conf
features_general_custom.conf
globals_custom.conf
sip.conf
sip_additional.conf
sip_custom.conf
sip_custom_post.conf
sip_general_additional.conf
sip_general_custom.conf
sip_nat.conf
sip_registrations.conf
sip_registrations_custom.conf
pygoogle Integration
Grab the install-gv-new script from:
Code:
wget http://bestof.nerdvittles.com/applicati ... all-gv-new
Patch it with the following diff

Save the patch as gv.patch

Code:
patch install-gv-new < gv.patch
patch for dd-wrt of install-gv-new
Code:
--- install-gv-new 2009-08-07 09:38:55.000000000 -0700
+++ install-gv-new-ddwrt 2009-08-10 08:35:16.838081906 -0700
@@ -9,7 +9,7 @@
echo " "
echo "If you make a typo while entering values below, press Ctrl-C and start over."
echo " "
-echo "Your Google Voice entries are stored in /etc/asterisk/extensions_custom.conf."
+echo "Your Google Voice entries are stored in /opt/etc/asterisk/extensions_custom.conf."
echo "Edit that file and reload your Asterisk dialplan if you make future changes."
echo " "
echo -n "10-digit Google Voice phone number (e.g. 9871234567): "
@@ -36,30 +36,30 @@
echo "Installing Google Voice support for your PBX. One moment please..."
echo " "

-echo " " >> /etc/asterisk/extensions_custom.conf
-echo "[custom-gv]" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,1,Wait(1)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,n,Set(ACCTNAME=$acctname)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,n,Set(ACCTPASS=$acctpass)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,n,Set(RINGBACK=$ringback)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,n,Set(CALLPARK=$callpark)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,n,Playback(pls-wait-connect-call)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,n,System(gvoice -e \${ACCTNAME} -p \${ACCTPASS} call \${EXTEN} \${RINGBACK})" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,n,Set(PARKINGEXTEN=\${CALLPARK})" >> /etc/asterisk/extensions_custom.conf
-echo "exten => _X.,n,Park()" >> /etc/asterisk/extensions_custom.conf
-echo " " >> /etc/asterisk/extensions_custom.conf
-echo "[custom-park]" >> /etc/asterisk/extensions_custom.conf
-echo "exten => s,1,Wait(4)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => s,2,Set(GVNUM=$gvnum)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => s,3,Set(CALLPARK=$callpark)" >> /etc/asterisk/extensions_custom.conf
-echo "exten => s,4,NoOp(**CALLERID: \${CALLERID(number)})" >> /etc/asterisk/extensions_custom.conf
-echo 'exten => s,5,GotoIf($["${CALLERID(number)}"="${GVNUM}"]?6:7)' >> /etc/asterisk/extensions_custom.conf
-echo "exten => s,6,ParkedCall(\${CALLPARK})" >> /etc/asterisk/extensions_custom.conf
-echo "exten => s,7,Goto(from-trunk,gv-incoming,1)" >> /etc/asterisk/extensions_custom.conf
-echo " " >> /etc/asterisk/extensions_custom.conf
+echo " " >> /opt/etc/asterisk/extensions_custom.conf
+echo "[custom-gv]" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,1,Wait(1)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,n,Set(ACCTNAME=$acctname)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,n,Set(ACCTPASS=$acctpass)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,n,Set(RINGBACK=$ringback)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,n,Set(CALLPARK=$callpark)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,n,Playback(pls-wait-connect-call)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,n,System(/opt/local/bin/gvoice -e \${ACCTNAME} -p \${ACCTPASS} call \${EXTEN} \${RINGBACK})" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,n,Set(PARKINGEXTEN=\${CALLPARK})" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => _X.,n,Park()" >> /opt/etc/asterisk/extensions_custom.conf
+echo " " >> /opt/etc/asterisk/extensions_custom.conf
+echo "[custom-park]" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => s,1,Wait(2)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => s,2,Set(GVNUM=$gvnum)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => s,3,Set(CALLPARK=$callpark)" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => s,4,NoOp(**CALLERID: \${CALLERID(number)})" >> /opt/etc/asterisk/extensions_custom.conf
+echo 'exten => s,5,GotoIf($["${CALLERID(number)}"="${GVNUM}"]?6:7)' >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => s,6,ParkedCall(\${CALLPARK})" >> /opt/etc/asterisk/extensions_custom.conf
+echo "exten => s,7,Goto(from-trunk,gv-incoming,1)" >> /opt/etc/asterisk/extensions_custom.conf
+echo " " >> /opt/etc/asterisk/extensions_custom.conf

echo "Reloading Asterisk dialplan..."
-asterisk -rx "dialplan reload"
+/opt/sbin/asterisk -rx "dialplan reload"
echo " "

if [ -e "/usr/bin/gvoice" ]
@@ -71,20 +71,23 @@
echo "Installing Python add-ons..."
cd /root
#yum install mercurial
-yum -y install python-setuptools
-easy_install simplejson
+#/opt/bin/ipkg-opt --tmp-dir /tmp install py25-setuptools
+#yum -y install python-setuptools
+#easy_install simplejson
+/opt/bin/ipkg-opt --tmp-dir /tmp install py25-simplejson
#hg clone https://pygooglevoice.googlecode.com/hg/ pygooglevoice

echo " "
echo "Installing pygooglevoice..."

wget http://bestof.nerdvittles.com/applicati ... evoice.tgz
+cd /tmp
tar zxvf pygooglevoice.tgz

cd pygooglevoice
-python setup.py install
+/opt/bin/python setup.py install

-sed -i 's| help(|# help(|' /usr/bin/gvoice
+sed -i 's| help(|# help(|' /opt/local/bin/gvoice

fi

Fire Up Asterisk
/opt/etc/S50asterisk stop
/opt/etc/S50asterisk start
kingfisher1111
MagicJack Expert
Posts: 76
Joined: Tue Nov 27, 2007 6:17 pm

Post by kingfisher1111 »

You should now have a working Asterisk Server with GV integration
Josemiami
MagicJack Expert
Posts: 85
Joined: Sun Jul 19, 2009 10:06 am

Post by Josemiami »

Question:

My router is a Linsys CL7C = WRT54GL v1.1 running with Firmware: DD-WRT v24-sp1 (07/27/2008) std. It wont flash with the mega.

Can I still run this version of asterisk?

Thanks
kingfisher1111
MagicJack Expert
Posts: 76
Joined: Tue Nov 27, 2007 6:17 pm

Post by kingfisher1111 »

Josemiami wrote:Question:

My router is a Linsys CL7C = WRT54GL v1.1 running with Firmware: DD-WRT v24-sp1 (07/27/2008) std. It wont flash with the mega.

Can I still run this version of asterisk?

Thanks
I h ave PM'ed you..
savant42
MagicJack Newbie
Posts: 1
Joined: Mon Aug 17, 2009 5:53 pm

Post by savant42 »

Any chance someone could post their conf files? I've been trying to follow along the nerdvittles tutorial but absolutely do not want to install FreePBX. Vanilla Asterisk for me, thanks.

I've got my sipgate did pointing toward an extension in my dial plan, which playsback a beep on answer, and that's all working great.

The part I don't understand is the parking lot. How do I derive the parking lot magic number? As far as I know, I don't have a parking lot configured. Is there a better link to demystify this process?

[edit: Ok, so I get it a little more. In my install of Asterisk, which is fairly default, the parking lot begins with extension 700 and goes through 720. So, if I understand this correctly, my magic number is 720. Is that right?]
pvsoares
MagicJack Newbie
Posts: 8
Joined: Wed Apr 17, 2013 3:17 pm

is it possible

Post by pvsoares »

if i buy one of the Linksys routers with the phone jack built in as well as the wi-fi built in the can i install DD-WRT in it and still make it Repeat a wi-fi signal and place and accept google calls or freepbx stuff?
crackerjack
Dan Should Pay Me
Posts: 784
Joined: Fri Nov 16, 2007 9:32 pm

Re: is it possible

Post by crackerjack »

pvsoares wrote:if i buy one of the Linksys routers with the phone jack built in as well as the wi-fi built in the can i install DD-WRT in it and still make it Repeat a wi-fi signal and place and accept google calls or freepbx stuff?
yes, no,yes, just be sure to engage QOS
Good Luck

CrackerJack

MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"
Post Reply