Skip to content

Instantly share code, notes, and snippets.

@nutanc
Created December 7, 2016 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nutanc/4fd9169d47dde5bc0ed55346c71bfdca to your computer and use it in GitHub Desktop.
Save nutanc/4fd9169d47dde5bc0ed55346c71bfdca to your computer and use it in GitHub Desktop.
<?php
session_start();
require_once('response.php');
$kk = new Response();
if (isset($_REQUEST['event']) && ($_REQUEST['event'] == 'NewCall')){
/*New Call Request */
$kk->addPlayText("please enter or say ten digits mobile number to which amount is to be transffered. after the beep",'2','best');
$kk->addRecognize('indybol','digits_hi',5,15,'en',10);
$_SESSION['block'] = 'menu1_output';
}
if (isset($_REQUEST['event']) && ($_REQUEST['event'] == 'Recognize') && ($_SESSION['block'] == 'menu1_output')){
if(!empty($_REQUEST['data'])){
$data = str_replace(' ', '', $_REQUEST['data']);
$data = trim($_REQUEST['data']);
$kk->addPlayText("you have entered.",'3','best');
$kk->addSayAs($data,501,'EN');
$kk->addPlayText("Please enter the amount to transfer.",'3','best');
$kk->addRecognize('indybol','digits_hi',5,8,'en',5);
$_SESSION['block'] = 'menu2_output';
}
else{
$kk->addPlayText("you have not entered any data.",'3','best');
}
}
else if (isset($_REQUEST['event']) && ($_REQUEST['event'] == 'Recognize') && ($_SESSION['block'] == 'menu2_output')){
if(!empty($_REQUEST['data'])){
$data = str_replace(' ', '', $_REQUEST['data']);
$data = trim($data);
$kk->addPlayText("You have entered.");
$kk->addSayAs($data,402,'EN');
$kk->addPlayText("Please enter your 4 digits pin.");
$kk->addRecognize('indybol','digits_hi',5,8,'en',4);
$_SESSION['block'] = 'menu3_output';
}
else{
$kk->addPlayText("you have not entered any data.",'3','best');
}
}
else if(isset($_REQUEST['event']) && ($_REQUEST['event'] == 'Recognize') && ($_SESSION['block'] == 'menu3_output')){
if(!empty($_REQUEST['data'])){
$data = str_replace(' ', '', $_REQUEST['data']);
$data = trim($_REQUEST['data']);
$kk->addPlayText("you have entered.",'3','best');
$kk->addSayAs($data,501,'EN');
$kk->addPlayText("Thanks for the inputs. your amount transfer request will be proccessed shortly.",'3','best');
/*
passed data to api. we can also play success or failure message based on api status and hangup
#also we can send confirmation sms to caller using sensSMS tag
*/
$kk->addHangup();
}
else{
$kk->addPlayText("you have not entered any data.",'3','best');
}
}
$kk->send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment