$confno = array(1234, 3424);
// 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");
    $_SESSION['session_id'] = $_REQUEST['sid'];
    //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
     $cd->setTermChar('#');
     $cd->addPlayText("Please enter number to send message and end with hash!");
     $r->addCollectDtmf($cd);
     $_SESSION['next_goto'] = 'phonemenu';
     //$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']);
$store = array(9704);
// 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");
Esempio n. 5
0
                 } else {
                     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
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;
}
require_once "response.php";
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();
        }
Esempio n. 8
0
<?php

include "php/db.php";
session_start();
require_once "response.php";
//include KooKoo library
$r = new Response();
//create a response object
$cd = new CollectDtmf();
if (isset($_REQUEST['event']) && $_REQUEST['event'] == 'NewCall') {
    $no = $_REQUEST['cid'];
    $result = mysqli_query($conn, "select * from user where  mobile='{$no}' ");
    $row_cnt = $result->num_rows;
    $row = mysqli_fetch_assoc($result);
    $userid = $row['id'];
    if ($row_cnt == 0) {
        $r->addPlayText("Sorry. This number is not registered. Thank you for calling, have a nice day");
        $postdata = "name=Audiochat&no=" . $no . "&msg=register at audiochat.azurewebsites.net  ";
        $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();
Esempio n. 9
0
     $collectInput->setTimeOut('4000');
     //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';
                 }