The OBi200 VoIP Phone Adapter is truly an amazing device. With the ability to seamlessly integrate with Google Voice (for free USA & Canada calling with very low rates elsewhere) and coupled with the ease of use to connect to many VoIP services, the Obi generally surpasses the expectations of most users – just look at the dazzling reviews over at Amazon.
However, recently I’ve been looking for a way to move away from this device onto a Virtual Machine on my ESXi box and give Asterisk a whirl. In my research, I came across The Incredible PBX and decided to give it a try.
Note: you need not install IncrediblePBX on VMware ESXi, really any old computer would do even a Raspberry Pi 2 would work!
Incredible PBX: What Is It?
Incredible PBX is a secure and feature-rich implementation of the terrific Asterisk® PBX. By rethinking the PBX security model from the ground up, Incredible PBX was engineered to provide rock-solid security while delivering the most comprehensive collection of Asterisk utilities available on the planet including free calling in the U.S. and Canada courtesy of Google Voice.
So Incredible PBX is an implementation of Asterisk PBX. Admittedly, I’ve always strayed away from setting up an Asterisk box due to its somewhat complex nature, obscure jargon and text-based configuration. But deep down, I knew that its benefits simply outweighed the costs in familiarizing myself with Asterisk. There is simply so much that can be done with Asterisk.
Asterisk: Now, What Is This?
Asterisk is an open source framework for building communications applications. Asterisk turns an ordinary computer into a communications server. Asterisk powers IP PBX systems, VoIP gateways, conference servers and other custom solutions. It is used by small businesses, large businesses, call centers, carriers and government agencies, worldwide. Asterisk is free and open source. Asterisk is sponsored by Digium.
Clearly, being somewhat green to this whole new Asterisk world, I simply didn’t think I’d be able to use it as a complete replacement to my Obi200 device. So I thought…
To accomplish this feat, I needed the Asterisk box to do the following:
- Ability to easily switch between placing outgoing calls between my VoIP provider and Google Voice (Mandatory)
- Ability to send Voicemails (MP3 format) to various emails (Mandatory)
- Ability to record calls on demand (Optional, but nice to have)
- Ability to see incoming Callers (ID/number) as notifications on my Kodi boxes (Optional, but nice to have)
In this blog post, I hope to cover the following:
- Initial installation of IncrediblePBX on an ESXi box
- Post-installation (VMware tools, static IP configuration)
- Configuration of GMail as a SMTP relay host for SendMail, Google Voice setup and G.729 codec installation
Ok, enough reading, let’s begin!
I first proceeded to download the IncrediblePBX 13.2 iso from here. I uploaded the ISO to the ESXi box and then created a VM with the following settings and a 12GB disk.
Setup was fairly straight forward. IncrediblePBX will reboot and then upgrade itself; download and compile and download and compile. Sit back and grab a coffee at this point. As an aside, IncrediblePBX is based on Scientific Linux which is a open source operating system based on Red Hat Enterprise Linux. So if you’re comfortable with Red Hat and/or comfortable with Linux, you should be good to go. If not, stop here and go bake a cake or something instead, ’cause all this may be over your head.
Set Passwords / Timezone
Assuming all went well with the installation, login with the root password and do the following:
Change your root password if it’s insecure:
Set your Incredible GUI admin password:
Set your web apps admin password:
htpasswd /etc/pbx/wwwpasswd admin
Set your correct time zone:
Next, I then installed the VMWare Tools package the typical way. Right click the VM, navigate to Guest -> Install/Upgrade VMWare Tools. Now enter the VM either via console or SSH.
Firstly, you need need to mount the virtual cdrom so that you can copy over the VMware Tools files.
mount /dev/cdrom /mnt
Now copy the files to your somewhere.
cp /mnt/VMwareTools-* /tmp cd /tmp
Now extract the archive.
tar -xzvf VMwareTools-*
Change to the extracted folder in order to run the VMware Tools installer.
Finally, run the installer accepting all defaults.
I generally like to give all my servers a static IP, this is box is no different. You can proceed to do so with Linux Webmin. Navigate to whatever is your current IP (or go straight to https:/IP:9001). You’ll see this.
Click on the Linux Webmin icon and enter your root password. Then Navigate to Networking -> Network Configuration and then Network Interfaces. Select eth0 and fill out the Static configuration fields. You probably want to also check on Routing and Gateways and Hostname and DNS Client for correct info.
GMail as a SMTP Relay Host for SendMail Setup
This step is somewhat complex, but here’s how I got it working. Credit goes to the folks over at PBXinaflash for getting this all working. Let’s first add the domain pbx.dyndns.org to your /etc/hosts file. So it looks as such (I believe the domain could be anything, doesn’t have to be real for this to work).
127.0.0.1 pbx.dyndns.org pbx.local localhost ...
And then make line 15 of /etc/asterisk/vm_general.inc look like the following:
Next preform all of the following:
cd /etc/mail hostname -f > genericsdomain touch genericstable makemap -r hash genericstable.db < genericstable mv sendmail.mc sendmail.mc.original wget http://nerdvittles.dreamhosters.com/pbxinaflash/source/sendmail/sendmail.mc.gmail cp sendmail.mc.gmail sendmail.mc mkdir -p auth chmod 700 auth cd auth echo AuthInfo:smtp.gmail.com \"U:smmsp\" \"I:user_id\" \"P:password\" \"M:PLAIN\" > client-info echo AuthInfo:smtp.gmail.com:587 \"U:smmsp\" \"I:user_id\" \"P:password\" \"M:PLAIN\" >> client-info echo AuthInfo:smtp.gmail.com:465 \"U:smmsp\" \"I:user_id\" \"P:password\" \"M:PLAIN\" >> client-info
Stop here and edit the client-info file you just created (nano -w client-info). Replace user_id with your GMail account name without @gmail.com and replace password with your real GMail password. Be sure to have the double-quotes if they don’t appear in the file!!! Save your changes (Ctrl-X, Y, then Enter).
chmod 600 client-info makemap -r hash client-info.db < client-info cd .. yum -y install sendmail-cf make service sendmail restart
Finally let’s give it a test. Hopefully this works for you, if not more info could be had at the PBXinaflash forums.
echo "incrediblePBX" | mail -s test <your_email address>
According to the article at PBXinaflash, there are 3 steps in getting Google Voice working with IncrediblePBX.
- Recompile Asterisk
- Get the OAuth tokens for your Google Voice account
- Enter your new Google Voice credentials in the GUI
1. Recompile Asterisk
cd /usr/src/asterisk-13* wget http://incrediblepbx.com/res_xmpp-13.tar.gz tar zxvf res_xmpp-13.tar.gz make distclean autoconf ./bootstrap.sh ./configure # in the menuselect module # enable all Add-ons except app_mysql # enable EXTRA-SOUNDS-EN-GSM in Extras Sound Packages # then Save & Exit make menuselect make make install cd ../Asterisk-Flit* make clean make make install amportal kill amportal restart cd /var/www/html/admin sed -i 's|Google Voice Password|Google Voice Refresh Token|' modules/motif/views/edit.php sed -i 's|This is your Google Voice Password|This is your Google Voice refresh token|' modules/motif/views/edit.php echo 13-12.3 > /etc/pbx/.version
2. Retreiving the OAuth Tokens
- Log into the Google account that includes the Google Voice number you wish to activate
- Maintaining your login with Google, open another tab and navigate to the Google OAuth 2.0 Playground with your browser.
- 3a. Check the box: Use your own OAuth credentials
- 3b. Enter this OAuth Client ID: 466295438629-prpknsovs0b8gjfcrs0sn04s9hgn8j3d.apps.googleusercontent.com
- 3c. Enter this OAuth Client secret: 4ewzJaCx275clcT4i4Hfxqo2
- 3d. Click Close.
- Click Step 1: Select and Authorize APIs
- 4a. In OAUTH Scope: https://www.googleapis.com/auth/googletalk
- 4b. Click Authorize APIs (blue) button.
- Click Step 2: Exchange authorization code for tokens
- 5a. Click Exchange authorization code for tokens (blue) button
- 5b. When the tokens have been generated, Step 2 will close.
- Reopen Step 2 and copy your Refresh_Token. This is the “password” you will need to enter (together with your Gmail account name and 10-digit GV phone number) when you add your GV trunk in the Incredible PBX GUI. Store this refresh_token in a safe place. Google doesn’t permanently store it either!
- Authorization tokens NEVER expire! If you ever need to remove your authorization tokens, go here and delete Incredible PBX Google Voice OAUTH entry by clicking on it and choosing DELETE option.
3. Enter your new Google Voice credentials in the GUI
Finally, add your Google Voice trunk in the GUI: Connectivity -> Google Voice (Motif) -> Add Google Voice Account.
Installing the Free G.729 Codec for Asterisk
The G.729 Codec is considered to offer a good level of call quality at a low bit rate of 8Kbps (kilobits per second), which would mean that you would be able to get more calls through your bandwidth if you were to use say another Codec. One consideration to make before using the G.729 Codec is that whilst is takes up a small amount of bandwidth to transmit the call data, it requires much more CPU processing time to make a call. In any case, let’s install it while we’re here. I’m using the Pentium compile binary from http://asterisk.hosting.lv/#bin, because I have a single core. The two most popular ones for Asterisk 13 are Pentium and X86_64-core2.
cd /usr/lib/asterisk/modules wget http://asterisk.hosting.lv/bin/codec_g729-ast130-gcc4-glibc-pentium.so mv codec_g729-ast130-gcc4-glibc-pentium.so codec_g729.so chmod 755 codec_g729.so
Now verify if the codec is installed.
asterisk -r core show translation
Now you should see the G.729 Codec installed and ready to use. Make sure it’s select in the GUI under Settings -> Asterisk SIP settings.
So quite a lot was accomplished today, we installed IncrediblePBX as a Virtual Machine on ESXi, did some basic configuration, and added GMail for SendMail and added a Google Voice trunk. Stay tuned next time when I’ll demonstrated a simple setup for a home environment and attempt to add Kodi notifications for incoming calls.
Thanks for stopping by!