-
-
Save saketkc/2373757 to your computer and use it in GitHub Desktop.
KooKoo Wedding IVR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
require_once("response.php");//response.php is the kookoo xml preparation class file | |
$r = new Response(); | |
$r->setFiller("yes"); | |
$recore_wav="update"; | |
if(isset ($_REQUEST['event']) && $_REQUEST['event']== "NewCall" ) | |
{ | |
$_SESSION['caller_number']=$_REQUEST['cid']; | |
$_SESSION['kookoo_number']=$_REQUEST['called_number']; | |
$_SESSION['session_id'] = $_REQUEST['sid']; | |
$_SESSION['next_block']='MainMenu'; | |
$_SESSION['event']='MainMenu'; | |
$_SESSION['playWelPrompt']=TRUE; | |
$_SESSION['invalidInput']=FALSE; | |
} | |
if (isset ($_REQUEST['event']) && ($_REQUEST['event']=="Disconnect" || $_REQUEST['event']=="Hangup") ){ | |
exit; | |
} | |
//Main-Menu | |
$cd = new CollectDtmf(); | |
if($_REQUEST['event'] == 'Record'){ | |
$cd->addPlayText('You have said'); | |
$cd->addPlayAudio($_REQUEST['data']); | |
} | |
if($_SESSION['next_block']=='MainMenu'){ | |
$cd->setMaxDigits(1); | |
if($_SESSION['playWelPrompt']){ | |
/*Invitation message*/ | |
$cd->addPlayAudio('http://recordings.kookoo.in/demouser/CordInvite.wav'); | |
} | |
if($_SESSION['invalidInput']){ | |
$cd->addPlayText('wrong input'); | |
} | |
$_SESSION['invalidInput']=FALSE; | |
$_SESSION['playWelPrompt']= FALSE; | |
/*Menu message. Press 1 for details etc*/ | |
$cd->addPlayAudio('http://recordings.kookoo.in/demouser/PressNo.wav'); | |
$r->addCollectDtmf($cd); | |
$_SESSION['next_block']='Menu1_CheckInput'; | |
} | |
else if($_SESSION['next_block']=='Menu1_CheckInput' && $_REQUEST['event'] == 'GotDTMF'){ | |
$_SESSION['input'] = urldecode($_REQUEST['data']); | |
if($_SESSION['input'] == '1'){ | |
/*More info message*/ | |
$r->addPlayAudio('http://recordings.kookoo.in/demouser/MoreInfo.wav'); | |
$_SESSION['next_block']='MainMenu'; | |
$_SESSION['event']='CollectNumber'; | |
} | |
elseif($_REQUEST['data'] == '*'){ | |
$_SESSION['record_wav'] = 'update'; | |
$_SESSION['next_block']='Record_Block'; | |
} | |
elseif($_REQUEST['data'] == '2'){ | |
/*Directions message*/ | |
$r->addPlayAudio('http://recordings.kookoo.in/demouser/Directions.wav'); | |
$_SESSION['next_block']='MainMenu'; | |
$_SESSION['event']='MainMenu'; | |
} | |
elseif($_REQUEST['data'] == '3'){ | |
$_SESSION['record_wav'] = $_SESSION['caller_number']; | |
$_SESSION['next_block']='Record_Block'; | |
} | |
elseif($_REQUEST['data'] == '4'){ | |
$r->addPlayAudio('http://recordings.kookoo.in/demouser/'.$_SESSION['caller_number'].'.wav'); | |
$_SESSION['next_block']='MainMenu'; | |
$_SESSION['event']='MainMenu'; | |
} | |
else{ | |
$_SESSION['next_block']='MainMenu'; | |
$_SESSION['invalidInput']=TRUE; | |
} | |
} | |
else if($_SESSION['next_block'] == 'Record_Block'){ | |
$r->addRecord($_SESSION['record_wav'], 'wav', '4', '100' ,'#'); | |
$_SESSION['next_block']='MainMenu'; | |
$_SESSION['event']='MainMenu'; | |
} | |
else if($_SESSION['next_block'] == 'Hangup' ){ | |
$r->addPlayText('Thanks you for calling, have nice day'); | |
$r->addHangup(); // do something more or to send hang up to kookoo | |
} | |
else { | |
//print you session param 'next_goto' and other details | |
$_SESSION['next_block']='Hangup'; | |
$r->addPlayText('Sorry, session and events not maintained properly, Thanks you for calling, have nice day'); | |
$r->addHangup(); // do something more or to send hang up to kookoo | |
} | |
$r->send(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment