Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

In this page, you can find an example of a web App written in PHP, which enables the validation of a form via an IVR extension. Download.

Table of Contents
maxLevel2

...

Overview

This App is useful for any developer of PHP applications as it contains basic examples of how to integrate third-party applications with VoipNow via VoipNow Call Interactive.

In order to be able to use the SecureMyForm App, you need a webserver with PHP 5.3 or higher installed.

Installation

STEP 1: Download the archive, extract the files, and copy them to a directory that can be accessed over the Web. Retrieve files from our GitHub repository:

Code Block
git clone https://github.com/4psa/app-securemyform.git

 

STEP 2: You You need to give proper permissions and ownership rights to the files of the plugin - the plugin needs to be owned by the web server user and group.
For example, if we use use httpd as as a webserver:

Code Block
chmod -R 755 <PATH_TO_CALLPARENT>
chwon -R httpd:httpd <PATH_TO_CALLPARENT>

STEP 3: In In order to use the App, you must first setup the database by running the SQL script located at at /sql/securemyform.sql. 

Now use those values to run the supplied SQL script:

...

Tip

You should have your DB admin setup a database for you, e.g. securemyformdb.

STEP 4: As As soon as the database is setup, you must configure it by opening the file file /config.php in the  in the <PATH_TO_SECUREMYFORM>/interface/plib/config.php and and changing the following settings:

NameDescription
VN_SERVER_IPVariable to the IP or hostname of your VoipNow server;
VN_IVR_EXTENSION EXTENSION Variable to the IVR extension that will be called by the number entered in the form;
VN_CHARGE_EXTENSION EXTENSION Variable to the extension that will initate the call, this is the extension that will call the number entered in the form;
RETURN_URL URL

Variable to the URL the request will be redirected to as soon as processed; You should use the following URL:

Code Block
http://<ip|host>/<PATH_TO_SECUREMYFORM>/interface/process.php
OAUTH_ACCESS_TOKEN TOKEN OAuth access token. This token is sent to the Unified API using the the Authorization HTTP HTTP header and has a limited life span of 2 hours, so be sure to renew it
MYSQL_HOST HOST Variable to the IP/host the database is located at;
MYSQL_USER USER Variable to the username used to access the database;
MYSQL_PASS PASS Variable to the username used to access the database;
MYSQL_DBNAME DBNAME Variable to the database name.

Behaviour

User Interface

STEP 1: Go Go to the URL URL https://<PATH_TO_SECUREMYFORM>/interface/index.php and and you will be able to see a form requiring your phone and email address details.

STEP 2:  Fill in your phone your phone number and press press Submit.

That number is called and once you pickup that number a new call will be placed to the IVR.

Note

A warning about 'CURLOPT_FOLLOWLOCATION' will be generated each time the request is made. Don't worry, this is ok and it won't interfere with the request.

STEP 3: The The form will refresh and show two digits that will be required when recording digits to variable.

STEP 4: Once Once the two digits are validated in the IVR the form will refresh and show that the request is completed.

...

As soon as the configuration process is completed, you need to to configure the IVR extension. This extension registers the number entered by the user and then calls the script ensuring the validation process.

As a result, you need to add an IVR action as described in the the Add IVR Context section section. The following actions must be added and executed according to the order indicated below:

01. Play Sound

You should add a sound containing the user instructions.

02. Record digits to variable

You must set the IVR to register a number of digits in a variable called called activationCode. This variable will be transmitted to the script validating the request.

...

03. Call Interactive

The configuration implies the following:

  • Request Method  - must be set to the method used to submit the form - by default it is configured to to GET.
  • Make request to  - must be set to an URL of the following form:

Code Block
http://<ip|host>/<PATH_TO_SECUREMYFORM>/ivr_validate.php?activationCode=$activationCode.

For more details, go to to IVR Extension.

When the button is pressed a new call is placed using the UnifiedAPI Create Simple PhoneCalls request:

...

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.