开发者

verify phone number php asterisk

开发者 https://www.devze.com 2023-03-10 19:02 出处:网络
I want to make it so when a customer is signing up on my website that next to the phone number field, there is a \"verify\" button, where once clicked a random string of digits is created, say 5 digit

I want to make it so when a customer is signing up on my website that next to the phone number field, there is a "verify" button, where once clicked a random string of digits is created, say 5 digits long, and one the verify button is clicked a phone call is placed to the number and a voice says something like "this is company and your phone verification number is 4 2 5 2 5" and repeats for a few minutes or until the correct number string is t开发者_运维问答yped into the phone. Once the phone number is verified the customer is allowed to submit the application.

I am looking to accomplishing this with asterisk and php. Is FastAGI the best way to accomplish this. So frat my research says that FastAGI is the best way, would I have to use http://code.google.com/p/fastagi-php-drclue/? Or should I just be using the regular asterisk agi?

How is the best way to pass the DTMF tones back the the PHP script?


You can use phpAGI to accomplish this task. You then use the originate command of the AMI. Passing the digits back to PHP is going to be problematic, as you can't raise user events because of the nature of PHP. Your best bet is to write the results to a database using the dialplan, and then periodically query the DB using ajax to see if the user has entered the proper verification code.

You can pass arbitrary variables into the dialplan within the originate call, so it should be easy to identify the user.

Honestly, it not that this is complicated, but it is convoluted, and quite a bit of detail is missing from my post. It's kind of difficult to explain this entire solution within a single post.

EDIT: If you use synchronous dialing, you will know when the call has completed. You will also need to set up an extension in your dialplan to handle the interactive portion. The originate command dials an outbound number, and when the call is connected, it then dials the extension specified in the originate command. Bear in mind though that Asterisk does not do call progress analysis over SIP lines, so that may or may not be a big problem for you.


This sounds like a pretty easy job for "AsterClick" [ http://www.asterclick.drclue.net ] AsterClick is the worlds only event driven Asterisk AMI/(XML)/HTML5 JavaScript

In the AsterClick context , your web page can actually place the call in real time and validate the results entirely in JavaScript.

If your looking for something a little more generic, simply create a routine that takes a phone number and emits a pin code based upon the number itself so that the Asterisk dialplan and your web page need not communicate at all.

I would build the routine using Asterisk's dialplan scripting and simply reproduce the resulting routine in JavaScript.

In this fashion you do away with a lot of programming hassles.

The AsterClick project has an ancestor project called FastAGI (A common name for such packages) http://code.google.com/p/fastagi-php-drclue/

This package treats your server side PHP scripts as dynamically loadable plugins that can be called from your dialplan with access to anything a regular PHP script has access to , plus all the particulars of the current call.

The FastAGI tool also has companion classes available for database interactions. So drop by the forums and mumble a few words and I or the users can set you on your way.

Keep in mind the Forum is HTML5 orientated, but we also have legacy tools too! All free of course

--Doc

0

精彩评论

暂无评论...
验证码 换一张
取 消