ftocc

Free Asterisk Calling Returns

UncleWard
Posts: 305
Member Since:
2006-05-31

djsullie
Posts: 138
Member Since:
2008-02-16
pretty interesting. Hate to

pretty interesting. Hate to complain about free calls but it does play a message when the far end picks up that reads "this is your free call from gizmo" If your ok with this message then its a great service.

Dan



UncleWard
Posts: 305
Member Since:
2006-05-31
Integrating Back Door Dialing Into Your FreePBX Dialplan

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.

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:

cd /var/lib/asterisk/agi-bin
wget <a href="http://pbxinaflash.net/source/gizmo/nv-gizmo.zip" title="http://pbxinaflash.net/source/gizmo/nv-gizmo.zip">http://pbxinaflash.net/source/gizmo/nv-gizmo.zip</a>
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:

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:

exten => s,n,AGI(nv-gizmo.php|${DIAL_NUMBER}|${DIAL_TRUNK})

In FreePBX 2.4, the code begins like this:

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:

exten => s,n,AGI(nv-gizmo.php|${DIAL_NUMBER}|${DIAL_TRUNK})

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!



SkykingOH
Posts: 3560
Member Since:
2007-12-17
One word of caution

Keep in mind that for any reason the script does not return cleanly all outbound dialing will stop working.

This is the same type of situation that occurs with the nerd-vittles caller-id lookup script. If your DNS is down or any of the service providers fail to answer the query any trunks that have the caller-id lookup script will hang on inbound.

Fun to play with at home, for a production environment I would think twice.

--

Scott

aka "Skyking"



UncleWard
Posts: 305
Member Since:
2006-05-31
I tend to agree only because

I tend to agree only because not many businesses are going to want their outbound calls prefaced with an announcement that "this is a free call from Gizmo." But, on the other points, you're a little off base. First, PHP scripts always have had a timeout. You can set it any way you like in php.ini. Second, if this script fails, the outbound number and trunk ID are preserved so it wouldn't kill any outbound call. And finally, of course, if your DNS or network is down, you've probably got much bigger problems than wrestling with this script. :-)



SkykingOH
Posts: 3560
Member Since:
2007-12-17
My experience with the NV

My experience with the NV caller ID script is that it does not time out, no matter what the php.ini settings are. I found this out quite by accident as I was using only an internal DNS server for a machine I was testing them on. I had moved that DNS then inbound dialing stopped. This was in the beginning of my Asterisk experience and it took me a few hours to find out why inbound calls where failing. There could have been a contention between the PHP timeout and the provider timeout since FreePBX would not answer the call until after the caller id macro is run.

With regard to the Gizmo bit, yes my statement was a bit silly as why would anyone use this service in a business, I have seen stranger things though.

--

Scott

aka "Skyking"



UncleWard
Posts: 305
Member Since:
2006-05-31
DNS Failures

Read this thread. I think you're confusing two different issues. Inbound call failure without local DNS support is a well-documented Asterisk problem. It has nothing to do with PHP much less Nerd Vittles scripts.



SkykingOH
Posts: 3560
Member Since:
2007-12-17
No, I have the caching name

No, I have the caching name server setup. Besides my trunks are referenced by an IP addressed not a host name.

In log the last thing that happens is control is handed off to the caller-id macro in FreePBX.

Now I am reaching too deep, it may have been a total loss of Internet that caused the script to hang, the trunks are on a gateway that is accessible on the LAN.

You have my interest, I will test this tonight and post my results.

--

Scott

aka "Skyking"



karllui2008
Posts: 154
Member Since:
2007-10-18
Gizmo5 Account

I have a Gizmo Account setup long time ago. It works fine. When you say:
"1. Sign up for a Gizmo5 account and set up your Gizmo trunk ... "
Do you mean I need to get a new account specific for Gizmo5 or my current account is ok?

When I try adding prefix 0101 to a 10-digit phone number I didn't get any message and the call was not connected either, just silence.

Thanks,



UncleWard
Posts: 305
Member Since:
2006-05-31
Existing account will do,

Existing account will do, but you may need to log in and set up a username for the account. They used to use the phone numbers, but they've switched over. And you have to use the username in your trunk setup.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.