Guinea Pigs Wanted
OK. We've got the dialplan functioning with Gizmo's Backdoor Dialing. The way this works goes like this. You dial a call. The outbound call progresses through the normal FreePBX routines to decipher the number and the outbound trunk. We then intercept the number and pass it to Gizmo5 to see if it's a free call. If it is, we add the 0101 prefix to the number and change the trunk number to match the Gizmo trunk number on your system.
1. Sign up for a Gizmo5 account and set up your Gizmo trunk using the
Nerd Vittles tutorial.
2. Next, you'll need to decipher the route number for your Gizmo trunk and write it down. Run this command and look for the number after OUT_ that matches your Gizmo trunk.
Code:
grep OUT_ /etc/asterisk/extensions_add* | awk '/ = / { print $0 }'
3. Figure out which version of FreePBX you have. I've only tested this with 2.3 and 2.4. Sorry.
4. Log in as root and download the nv-gizmo AGI script into /var/lib/asterisk/agi-bin. Then edit the script and plug in your Gizmo trunk number (from above) as well as your Gizmo username and your Gizmo password after executing the following commands:
Code:
cd /var/lib/asterisk/agi-bin
wget http://pbxinaflash.net/source/gizmo/nv-gizmo.zip
unzip nv-gizmo.zip
rm nv-gizmo.zip
chown asterisk:asterisk nv-gizmo.php
chmod +x nv-gizmo.php
nano -w nv-gizmo.php
5. Finally, we're going to customize your FreePBX dialplan so that the changes don't get overwritten. To do this, you have to cut-and-paste the entire [macro-dialout-trunk] context from /etc/asterisk/extensions.conf (in FreePBX 2.3) or /etc/asterisk/extensions_additional.conf (in 2.4). Put a duplicate of the code at the end of /etc/asterisk/extensions_override_freepbx.conf. Be very careful to widen the window for your editor so that you get all of the text of each line when you cut and paste.
In FreePBX 2.3, the code begins like this:
Code:
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(ROUTE_PASSWD=${ARG3})
Add a new line immediately below those lines that looks like this:
Code:
exten => s,n,AGI(nv-gizmo.php|${DIAL_NUMBER}|${DIAL_TRUNK})
In FreePBX 2.4, the code begins like this:
Code:
include => macro-dialout-trunk-custom
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n,ExecIf($[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]],Authenticate,${ARG3})
exten => s,n,GotoIf($["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]?disabletrunk,1)
exten => s,n,Set(DIAL_NUMBER=${ARG2})
Add a new line immediately below those lines that looks like this:
Code:
exten => s,n,AGI(nv-gizmo.php|${DIAL_NUMBER}|${DIAL_TRUNK})
If you're using Asterisk 1.6, change the vertical bars (|) above to commas. Save your changes and
asterisk -rx "dialplan reload" and you're all set. To test it out, you can place a call to my non-working Sprint number which should be processed as a free call: 678-612-7695. You'll get a Sprint recording telling you the number is not in service. Check the output on your Asterisk CLI. Enjoy!