// declaration of array
if ($_REQUEST['event'] == "NewCall") {
    $collectInput = new CollectDtmf();
    $collectInput->addPlayText('please enter the conference number followed by hash', 3);
    $collectInput->setMaxDigits('4');
    //max inputs to be allowed
    $collectInput->setTimeOut('4000');
    //maxtimeout if caller not give any inputs
    $collectInput->setTermChar('#');
    $r->addCollectDtmf($collectInput);
    $_SESSION['next_goto'] = 'conference';
} else {
    if ($_REQUEST['event'] == "GotDTMF" && $_SESSION['next_goto'] == 'conference') {
        if ($_REQUEST['data'] == "") {
            $collectInput = new CollectDtmf();
            $collectInput->addPlayText("You have not given any input");
            $collectInput->addPlayText('please enter the conference number again followed by hash', 3);
            $collectInput->setMaxDigits('4');
            //max inputs to be allowed
            $collectInput->setTimeOut('4000');
            //maxtimeout if caller not give any inputs
            $collectInput->setTermChar('#');
            $r->addCollectDtmf($collectInput);
            $_SESSION['next_goto'] = 'conference';
        } else {
            if ($_REQUEST['data'] == $confno[0]) {
                $r->addPlayText("Please be online while we connect you. Thank you");
                $r->addConference($confno[0]);
            } else {
                $r->addPlayText("Your input has been not matched with any our conference numbers");
            }
    //sid is unique callid for each call
    // you maintain one session variable to check position of your call
    //here i had maintain next_goto as session variable
    $_SESSION['next_goto'] = 'Menu1';
}
if ($_REQUEST['event'] == "Disconnect" || $_REQUEST['event'] == "Hangup") {
    //when users hangs up at any time in call  event=Disconnect
    // when applicatoin sends hangup event event=Disconnect
    //if users hang up the call in dial event you will get data ans status params also
    //$_SESSION['dial_record_url']=$_REQUEST['data'];
    //$_SESSION['dial_status']=$_REQUEST['status'];
    exit;
}
if ($_SESSION['next_goto'] == 'Menu1') {
    $collectInput = new CollectDtmf();
    $collectInput->addPlayText('Welcome to Koo Koo. Are you new to place?', 4);
    $collectInput->addPlayText('press 1 for entering location, press 2 for nearby places, press 3 for weather details', 4);
    $collectInput->setMaxDigits('1');
    //max inputs to be allowed
    $collectInput->setTimeOut('4000');
    //maxtimeout if caller not give any inputs
    $r->addCollectDtmf($collectInput);
    $_SESSION['next_goto'] = 'Menu1_CheckInput';
} else {
    if ($_REQUEST['event'] == 'GotDTMF' && $_SESSION['next_goto'] == 'Menu1_CheckInput') {
        //input will come data param
        //print parameter data value
        if ($_REQUEST['data'] == '') {
            //if value null, caller has not given any dtmf
            //no input handled
            $r->addPlayText('you have not entered any input');
Пример #3
0
     //$r->addHangup();
 } else {
     if ($_SESSION['next_goto'] == 'phonemenu' && isset($_REQUEST['event']) && $_REQUEST['event'] == 'GotDTMF') {
         if (isset($_REQUEST['data']) && !empty($_REQUEST['data']) && strlen($_REQUEST['data']) >= 9) {
             $_SESSION['pref_num'] = $_REQUEST['data'];
             $r->addPlayText('Please Record Your Message to send!');
             //give unique file name for each recording
             $r->addRecord('filename2', 'wav', '120');
             $_SESSION['next_goto'] = 'Record_Status';
         } else {
             $r->addPlayText("you have not given any input please re enter or wrong input");
             $cd = new CollectDtmf();
             //initiate new collect dtmf object
             $cd->setMaxDigits(10);
             $cd->setTermChar('#');
             $cd->addPlayText("Please enter number to send message end with hash!");
             $r->addCollectDtmf($cd);
             $_SESSION['next_goto'] = 'phonemenu';
         }
     } else {
         if ($_REQUEST['event'] == 'Record' && $_SESSION['next_goto'] == 'Record_Status') {
             //recorded file will be come as  url in data param
             //print parameter data value
             $r->addPlayText('your recorded audio is ');
             $_SESSION['record_url'] = $_REQUEST['data'];
             error_log($_SESSION['record_url']);
             $r->addPlayAudio($_SESSION['record_url']);
             $r->addPlayText('Thanks you for calling, we will deliver your message');
         } else {
             if ($_REQUEST['event'] == 'Dial' && $_SESSION['next_goto'] == 'Dial1_Status') {
                 //dial url will come data param  //if dial record false then data value will be -1 or null
// declaration of array
if ($_REQUEST['event'] == "NewCall") {
    $collectInput = new CollectDtmf();
    $collectInput->addPlayText('please enter the pin', 3);
    $collectInput->setMaxDigits('4');
    //max inputs to be allowed
    $collectInput->setTimeOut('4000');
    //maxtimeout if caller not give any inputs
    $collectInput->setTermChar('#');
    $r->addCollectDtmf($collectInput);
    $_SESSION['next_goto'] = 'check_pin';
} else {
    if ($_REQUEST['event'] == "GotDTMF" && $_SESSION['next_goto'] == 'check_pin') {
        if ($_REQUEST['data'] == "") {
            $collectInput = new CollectDtmf();
            $collectInput->addPlayText('You have not given any input', 3);
            $collectInput->addPlayText('please enter the pin again', 3);
            $collectInput->setMaxDigits('4');
            //max inputs to be allowed
            $collectInput->setTimeOut('4000');
            //maxtimeout if caller not give any inputs
            $collectInput->setTermChar('#');
            $r->addCollectDtmf($collectInput);
            $_SESSION['next_goto'] = 'check_pin';
        } else {
            if ($_REQUEST['data'] == $store[0]) {
                $r->addPlayText("Welcome to YourCompany");
                //your code here
            } else {
                $r->addPlayText("The pin you entered is wrong");
                $r->addHangup();
function press1DTMF()
{
    $cd = new CollectDtmf();
    //initiate new collect dtmf object
    $cd->addPlayText("We will send you and sms for this job, please check within 5 minutes");
    $cd->addPlayText("Press 1, to hear more jobs like this");
    $cd->addPlayText("Press 2, to hear same job but in different place");
    $cd->addPlayText("Press 3, to hear about different job in different place");
    $cd->addPlayText("Press 4, to change salary");
    $cd->setMaxDigits(1);
    return $cd;
}
Пример #6
0
                     if ($_REQUEST['data'] == '4') {
                         $r->addGoto('http://127.0.0.1/kookoophp/demo_gotopage.php');
                         //update the url to redirect from demo.php to demo_gotopage.php
                         //url should be full url : 'http://host../nextapp.app' it will jump to next url
                         $_SESSION['next_goto'] = 'Menu1';
                     } else {
                         $r->addPlayText('Thats an invalid input');
                     }
                 }
             }
         }
     }
 } else {
     if ($_SESSION['next_goto'] == 'DialMenu') {
         $collectInput = new CollectDtmf();
         $collectInput->addPlayText('please enter the number that you want to dial followed by hash, if it is s t d number, enter 0 as pre fix ', 3);
         //$collectInput->addPlayText('press 1 for record, press 2 dial press 3 for cc transer',4);
         $collectInput->setMaxDigits('15');
         //max inputs to be allowed
         $collectInput->setTimeOut('4000');
         //maxtimeout if caller not give any inputs
         $collectInput->setTermChar('#');
         $r->addCollectDtmf($collectInput);
         $_SESSION['next_goto'] = 'Menu1_CheckInput1';
     } else {
         if ($_REQUEST['event'] == 'GotDTMF' && $_SESSION['next_goto'] == 'Menu1_CheckInput1') {
             //input will come in data param
             //print print parameter data value
             if ($_REQUEST['data'] == '') {
                 //if value null, caller has not given any dtmf
                 //no input handled
Пример #7
0
<?php

//Description:Sample Code to check a pin given by user.
require_once "response.php";
//response.php is the kookoo xml preparation class file
$r = new Response();
$store = array(9704);
// declaration of array
if ($_REQUEST['event'] == "NewCall" || $_SESSION['next_goto'] == 'restart') {
    $collectInput = new CollectDtmf();
    $collectInput->addPlayText('please enter the pin', 3);
    $collectInput->setMaxDigits('4');
    //max inputs to be allowed
    $collectInput->setTimeOut('4000');
    //maxtimeout if caller not give any inputs
    $collectInput->setTermChar('#');
    $r->addCollectDtmf($collectInput);
    $_SESSION['next_goto'] = 'check_pin';
} else {
    if ($_SESSION['next_goto'] == 'check_pin') {
        if ($_REQUEST['data'] == "") {
            $r->addPlayText("You have not given any input");
            $_SESSION['next_goto'] = 'restart';
        } else {
            if ($_REQUEST['data'] == $store[0]) {
                $r->addPlayText("Welcome to YourCompany");
                //your code here
            } else {
                $r->addPlayText("The pin you entered is wrong");
                $r->addHangup();
                //call disconnects at this stage
session_start();
$r = new Response();
if ($_REQUEST['event'] == "NewCall") {
    $cd = new CollectDtmf();
    $cd->setTermChar("#");
    $cd->setTimeOut("4000");
    $cd->addPlayText("welcome to adder.Please enter your first number.Terminate with hash");
    $r->addCollectDtmf($cd);
    $_SESSION['state'] = "firstNumber";
    $r->send();
} else {
    if ($_REQUEST['event'] == "GotDTMF" && $_SESSION['state'] == "firstNumber") {
        $first = $_REQUEST['data'];
        $cd = new CollectDtmf();
        $cd->setTermChar("#");
        $cd->setTimeOut("4000");
        $cd->addPlayText("Please enter the Second number.Terminate with hash");
        $_SESSION['firstNumber'] = $first;
        $_SESSION['state'] = "secondNumber";
        $r->addCollectDtmf($cd);
        $r->send();
    } else {
        if ($_REQUEST['event'] == "GotDTMF" && $_SESSION['state'] == "secondNumber") {
            $second = $_REQUEST['data'];
            $total = $_SESSION['firstNumber'] + $second;
            $r->addPlayText("your total is {$total}");
            $r->addHangup();
            $r->send();
        }
    }
}
Пример #9
0
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'http://faltusms.tk/sendSms.php');
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 60);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
        curl_setopt($ch, CURLOPT_POST, 1);
        $result = curl_exec($ch);
        $r->addHangup();
        $r->send();
        exit;
    }
    $cd->addPlayText("Welcome to audio chat. Press 1 to broadcast your story , 2 to listen to friends .");
    // play options
    $r->addCollectDtmf($cd);
} elseif (isset($_REQUEST['event']) && $_REQUEST['event'] == 'GotDTMF') {
    $no = $_REQUEST['cid'];
    $result = mysqli_query($conn, "select * from user where  mobile='{$no}' ");
    $row = mysqli_fetch_assoc($result);
    $userid = $row['id'];
    $name = $row['name'];
    $choice = $_REQUEST['data'];
    if ($choice == "1") {
        $r->addPlayText("Record your message after the beep ");
        $n = $_REQUEST['cid'];
        $r->addRecord($userid . "_" . md5(time()));
        //record message
        $r->maxduration = 15;
<?php

//Description:Sample Code implementing usage of conference dynamically
require_once "response.php";
//response.php is the kookoo xml preparation class file
$r = new Response();
$confno = array(1234, 3424);
// declaration of array
if ($_REQUEST['event'] == "NewCall" || $_SESSION['next_goto'] == 'restart') {
    $collectInput = new CollectDtmf();
    $collectInput->addPlayText('please enter the conference number followed by hash', 3);
    $collectInput->setMaxDigits('4');
    //max inputs to be allowed
    $collectInput->setTimeOut('4000');
    //maxtimeout if caller not give any inputs
    $collectInput->setTermChar('#');
    $r->addCollectDtmf($collectInput);
    $_SESSION['next_goto'] = 'conference';
} else {
    if ($_SESSION['next_goto'] == 'conference') {
        if ($_REQUEST['data'] == "") {
            $r->addPlayText("You have not given any input");
            $_SESSION['next_goto'] = 'restart';
        } else {
            if ($_REQUEST['data'] == $confno[0]) {
                $r->addPlayText("Please be online while we connect you. Thank you");
                $r->addConference($confno[0]);
            } else {
                $r->addPlayText("Your input has been not matched with any our conference numbers");
            }
        }
Пример #11
0
     //maxtimeout if caller not give any inputs
     $r->addCollectDtmf($collectInput);
     $_SESSION['next_goto'] = 'Menu2_CheckInput';
 } else {
     if ($_REQUEST['event'] == 'GotDTMF' && $_SESSION['next_goto'] == 'Menu2_CheckInput') {
         //input will come data param
         //print parameter data value
         if ($_REQUEST['data'] == '') {
             //if value null, caller has not given any dtmf
             //no input handled
             $r->addPlayText('you have not entered any input');
             $_SESSION['next_goto'] = 'Menu2';
         } else {
             if ($_REQUEST['data'] == '1') {
                 $collectInput = new CollectDtmf();
                 $collectInput->addPlayText('Please enter your 6 digit pincode', 4);
                 $collectInput->setMaxDigits('6');
                 //max inputs to be allowed
                 $collectInput->setTimeOut('7000');
                 //maxtimeout if caller not give any inputs
                 $r->addCollectDtmf($collectInput);
                 $_SESSION['next_goto'] = 'Pincode_CheckInput';
             } else {
                 if ($_REQUEST['data'] == '2') {
                     $r->addPlayText('Thank you for calling, have a nice day');
                     $r->addHangup();
                 } else {
                     $r->addPlayText('Thats an invalid input');
                     $_SESSION['next_goto'] = 'Menu2';
                 }
             }