VoipJots.com: Click-to-Call with your Asterisk@Home Box: "Click-to-Call with your Asterisk@Home Box
It seems everyone is talking about Click-to-Call functionality these days. Google has announced they are going to do it, EBay will be doing it before too long, and there are other websites out there that I've recently noticed are offering this service.
Click-to-Call seems like it would be a complicated task to setup; enabling a website visitor to click a button to allow them to submit their phone number, and receive a call from someone a few seconds later, with no long distance charges for the visitor.
If you have an AAH or Asterisk box, it really is not that difficult to add such a feature to your website. A very simple PHP page hosted either on your AAH box, or another PHP-capable web server (that has TCP connectivity to your AAH/Asterisk box) is all you need. Last night I developed such a script, and though it is rather simple, it's effective. I plan on doing more with it later, but thought I'd share it will all of you so that you can begin playing with it, or customizing it yourself. This script was written for AAH, so it probably will not work with a regular Asterisk box without some modifications, or even a heavily customized AAH box. However, it's very straight-forward, and should not be hard to debug if you have problems with it."
To the expert PHP'ers out there, this was my first attempt at doing anything with PHP (I'm an ASP guy), so have pity on me!:)
Ok, here it goes.
I'm going to be explaining how to set this script up on an AAH box, but as I said before, it should work on any PHP server that can communicate with your AAH/Asterisk box. Also, I have only tested this on AAH 2.4, so I don't make any guarantees that it works on anything else. In fact, I don't make any guarantees that it works on any AAH 2.4 box besides my own, though it should. :) While I'm at it, I may as well also mention that if you decide to use this script, you do so at your own risk.
Step 1:
Login to your AAH box and enter these commands:
cd /tmp
wget http://downloads.voipjots.com/scripts/click-to-call.zip
unzip click-to-call.zip
mv click-to-call.php /var/www/html/click-to-call.php
rm click-to-call.zip
Step 2:
Now we have to slightly edit the script to get it to work for you.
cd /var/www/html
nano -w click-to-call.php
For a typical AAH box, you should only need to edit one line in the script. Change the line:
:
$strChannel = "IAX2/250";
to reflect one of your extensions. In my case, I am using my Idefisk IAX2 softphone that has an extension number of 250. For instance, if you have a SIP soft/hard phone that has an extension number of 1234, you would change this line to:
$strChannel = "SIP/1234";
Ok, at this point, we should have everything properly configure on our AAH box. Now we can try it!
Step 3:
In a web browser, go to http://my-aah-ip-address/click-to-call.php
You should see this:
While near the soft/hard phone belonging to the extension you specified above, enter a valid 11 digit phone number, and click on the Call Us! button.
The soft/hard phone should begin ringing, showing "Web Call " as the caller id. When you answer the call, you will briefly hear... nothing (something I'm going to be working on in the near future), but after a few seconds, you will hear ringing as it calls the number that was entered on the web page.
The click-to-call web page should now be this:
This script is very simple, and probably not best hosted on your aah box, but on another web server that hosts the site you would want to add click-to-call functionality to. However, I hope that this provides a good demonstration as to exactly how simple it is to implement click-to-call with AAH, and leave it to you and your creativity on exactly how you wish to offer this feature. The sky's the limit, really.
I hope this has been helpful to someone. If you have any ideas on how to improve the script, please let me know by leaving your comments. If you make significant improvements to the script, I would appreciate it if you shared them with all of us.
Enjoy!
Olin
No hay comentarios:
Publicar un comentario