After completely rewriting ENUMPlus from the ground up (2 days total) we have come much closer to a universal ENUM lookup source. The new module can be downloaded here so install it now! Here’s why :
- The module forms a HTTP request to our API which queries many other sources and returns the most accurate address.
- There is no longer a need to add multiple lookup sources to the old enumlookup AGI.
- It audibly notifies you when the call is made over ENUM.
- You can track your calls in the panel.
- White pages / search functionality (including avatars
) - Call validation is much more stable.
If you don’t have an account, get one – registration is quick and simple and you will be a happy geek.
Check out the project page / wiki / site / sourceforge / FreePBX / voip-info / piaf for more info.
It gets very repetitive writing forms for clients – that’s why I decided to take the last hour to write this piece of fine code.
It takes whatever title you give a form object and creates a copy / paste dump for your view, controller and Javascript. It doesn’t handle checkboxes or select boxes – but that is because I find the form is not the time killer; it’s the Javascript and validation. The nice part is that most of the heavy lifting is done for you – plus you do not have to worry about spelling mistakes or silly syntax stuff because it is all duped in the script.
I’d like to pop this up on a subdomain after making it pretty – please comment if you think you will find this little app useful.
PS. During the recording I noticed a small error in the code – no need to comment, it is fixed now. The json_encoded array was returning a value that would not display in the error fields due to a mismatch in the name.
UPDATE : Check Out the Application Here!
I have fully tested the generated code and it works great, here’s a video demonstrating how to use “FormTorch”.
This is a great technique for use with large forms with many values you need to save. It can get in the way if you need individual validation for each value – however it can save a whole ton of time when submitting any number of form fields.
The video isn’t super high quality so I have attached the source here.
This weeks project has been a huge learning curve for both Asterisk and communicating with a remote web server. Here are the project goals :
- End user (EU from now on) creates an account on web server.
- EU Inputs their phone number.
- EU immediately receives a call with a random 6 digit number (PIN).
- EU inputs the PIN into the web interface and is now validated.
- EU schedules when they want to be called.
When the user is called, they are sent to an IVR (interactive voice menu) – here is how that should work.
- EU answers the call.
- EU hears prompt to press 1, 2 or 3.
- EU presses 1 and hears a prompt with instructions (it is a breathing exercise)
- EU presses pound to initiate timer and pound once again to end their session.
- EU hears prompt directing them to visit web panel to access results.
OK so you see how this is supposed to work – let me explain how I did it.
Step 1. Phone Number Validation
The user enters their phone number in three separate boxes which are heavily processed for error checking and validation. The number is stored in the database and they are sent to the next page of the wizard. This page displays a button to initiate the call with a text input box below for the phone pin. A random 6 digit number is generated, inserted into the database and also passed to the AMI. An Originate action is called sending the EU to a passwd-verify-custom context in the dial plan.
The EU hears a prompt to wait for their verification number – the six digit number passed from the web server is then read to the EU using SayDigits(${UserPin}). As soon as they enter the PIN in the text box, their phone number is validated and they can begin receiving scheduled calls.
Step 2. Scheduling Calls
The EU is presented with several drop downs : Day (Sunday to Saturday), Hour (01 – 12), Minute (01 – 59), Time (AM – PM). Once the time is selected and the submit button is pressed, an asynchronous post is sent back to the web server for validation and insertion into the database.
It was super easy to run the schedule without having to SCP .call files or open more holes on the Asterisk system. I simply run a cron job every minute that pings a listening PHP script on the web server. PHP queries the database to see if anyone has a call scheduled and has validated their number, PHP will loop through the results creating a new AMI event passing the users unique ID as a dial plan variable.
Part 3. Collecting Key Press Event Data
The IVR is very straight forward. It is used to determine the EPOCH second for the start and stop time for this breathing exercise. On key press, Asterisk runs System(/usr/bin/curl -d “userid=${UserId}&action=start&time=${EPOCH}&key=someuniquehash” <http://tld/script.php>)
This sends back to the web server the following data :
User ID – the user ID sent to the AMI from the web server : Now we know who we called
Action – Start, Stop : Now we know whether to insert or update the record
Time – The Epoch time stamp : Now we know when the key was pressed.
Key – A long string of random characters : This way no one can inject false data from their browser.
Once the phone session is complete, the user can login to their panel and view in depth statistics and compare month and year breathing fluctuation times in an easy to read bar graph.
The key things I have learned during creation of this application will allow me to do anything in the field of Web + Phone integration.
Passing a variable to the dial plan from an AMI event is by far the most powerful:
Variable : <VariableName> = <VariableValue>
This can now be accessed in the dial plan using ${VariableName}
I am creating a video demonstrating how to use the application (for end users) – I will post it up here when it is done. If you want to try it yourself check out Control Pause.




