Create an IVR Input Function
From Taridium
(19 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | This How-To shows you how to create an IVR Input | + | This '''How-To''' shows you how to create an IVR Input function to opt out of a fax marketing list. The example below uses PHP, but really any web language will do. It will validate the input against a dataset and remove the number from the list on success. This could also be easily used to grant access to other IVRs and functions requiring authentication. |
- | Detailed instructions on all configuration elements for IVR inputs can be found [[IVR Input|here]]. | + | Detailed instructions on all configuration elements for IVR inputs can be found [[IVR Input|here]]. If you are looking for more complex call processing using external data, check out the [[CTI|ipbx CTI module]]. |
- | [[File:ivr-input.png]] | + | |
+ | == Record Prompts == | ||
+ | |||
+ | Record your query prompt using the prompt recording function or upload a pre-recorded file. Detailed instructions on prompt recording and uploading can be found [[Voice_Prompts|here]]. Do the same for your validation success and failure prompts. | ||
+ | |||
+ | == Create Input == | ||
+ | [[File:ivr-input.png|thumb|Example]] | ||
+ | Create an IVR Input called 'OptOut' and select your newly created prompt. Set an optional extension for testing purposes and enter the maximum number of digits you will accept. In this case we set it to 10 digits for North American numbers. | ||
+ | |||
+ | == Input Validation == | ||
+ | Your input validation URL will call a script to validate the input number. Set the retries to 2, for a maximum of 3 attempts. Set your success and failure prompts from the drop-down boxes. Check '''hangup on failure'''. | ||
+ | |||
+ | ===Validation Script=== | ||
+ | |||
+ | <pre> | ||
+ | <? | ||
+ | /* A simple script to validate input against a value */ | ||
+ | /* valid numbers */ | ||
+ | $mydb[] = "2125551001"; | ||
+ | $mydb[] = "2125551002"; | ||
+ | $mydb[] = "2125551003"; | ||
+ | $mydb[] = "2125551004"; | ||
+ | $mydb[] = "2125551005"; | ||
+ | |||
+ | if ($_GET['input']){ | ||
+ | |||
+ | if (in_array($_GET['input'],$mydb)){ | ||
+ | |||
+ | $reply = "VALID"; | ||
+ | |||
+ | } else { | ||
+ | |||
+ | $reply = "INVALID"; | ||
+ | |||
+ | } | ||
+ | |||
+ | } else { | ||
+ | |||
+ | $reply = "INVALID"; | ||
+ | |||
+ | } | ||
+ | |||
+ | echo $reply; | ||
+ | ?> | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | == Result == | ||
+ | |||
+ | Set the URL you want to call if you are sure this is a valid and accepted number. The script below is a very simple example on how to accept the value from the %%input%%% variable. | ||
+ | |||
+ | ===Result Script=== | ||
+ | <pre> | ||
+ | <? | ||
+ | /* A simple script to simulate a database update */ | ||
+ | |||
+ | if ($_GET['input']){ | ||
+ | |||
+ | removeNumberFromFaxDatabase($_GET['input']); | ||
+ | |||
+ | } | ||
+ | ?> | ||
+ | </pre> |
Latest revision as of 21:32, 4 February 2011
This How-To shows you how to create an IVR Input function to opt out of a fax marketing list. The example below uses PHP, but really any web language will do. It will validate the input against a dataset and remove the number from the list on success. This could also be easily used to grant access to other IVRs and functions requiring authentication.
Detailed instructions on all configuration elements for IVR inputs can be found here. If you are looking for more complex call processing using external data, check out the ipbx CTI module.
Contents |
Record Prompts
Record your query prompt using the prompt recording function or upload a pre-recorded file. Detailed instructions on prompt recording and uploading can be found here. Do the same for your validation success and failure prompts.
Create Input
Create an IVR Input called 'OptOut' and select your newly created prompt. Set an optional extension for testing purposes and enter the maximum number of digits you will accept. In this case we set it to 10 digits for North American numbers.
Input Validation
Your input validation URL will call a script to validate the input number. Set the retries to 2, for a maximum of 3 attempts. Set your success and failure prompts from the drop-down boxes. Check hangup on failure.
Validation Script
<? /* A simple script to validate input against a value */ /* valid numbers */ $mydb[] = "2125551001"; $mydb[] = "2125551002"; $mydb[] = "2125551003"; $mydb[] = "2125551004"; $mydb[] = "2125551005"; if ($_GET['input']){ if (in_array($_GET['input'],$mydb)){ $reply = "VALID"; } else { $reply = "INVALID"; } } else { $reply = "INVALID"; } echo $reply; ?>
Result
Set the URL you want to call if you are sure this is a valid and accepted number. The script below is a very simple example on how to accept the value from the %%input%%% variable.
Result Script
<? /* A simple script to simulate a database update */ if ($_GET['input']){ removeNumberFromFaxDatabase($_GET['input']); } ?>