Exemplo n.º 1
0
            case "*":
                // hang up the IVR channel and possibly the incoming call
                IVR::Hangup();
                break;
            case "#":
                // return to calling IVR with value 'Got #'
                IVR::Leave("Got {$tone}");
                break;
            case "0":
            case "1":
            case "2":
                $this->Output("Got {$tone}");
                break;
            default:
                return false;
        }
        return true;
    }
}
// initialize the Yate PHP library with default values, enable output to rmanager and debugging
Yate::Init();
Yate::Output(true);
Yate::Debug(true);
// register the two IVR classes with some names
IVR::Register("ivr1", "IVR1");
IVR::Register("ivr2", "TheIVR_2");
// and start running by entering the 1st IVR
IVR::Run("ivr1");
// if we reach here the IVR is terminated
Yate::Output("PHP: bye!");
/* vi: set ts=8 sw=4 sts=4 noet: */
Exemplo n.º 2
0
#!/usr/bin/php -q
<?php 
/*
 *  IVR.php
 *  
 *  IVR AGI приложение для Asterisk PBX
 *  
 *  Григорий Майстренко (Grygorii Maistrenko)
 *  grygoriim@gmail.com
 */
include dirname(__FILE__) . "/lib/Class.IVR.php";
include dirname(__FILE__) . "/lib/phpagi-2.14/phpagi.php";
$agi = new AGI();
//$agi->verbose(basename(__FILE__).":".__LINE__." - Входящие параметры ".print_r($argv, true));
if (isset($argv[1]) && $argv[1] != "") {
    $MENUID = $argv[1];
    //$agi->verbose(basename(__FILE__).":".__LINE__." - Передан параметр".print_r($resrun, true));
} else {
    $MENUID = "common";
}
$ivr = new IVR($agi);
$resrun = $ivr->Run($MENUID);
if ($resrun != '-1') {
    // делаем трансфер
    $resrun = $agi->exec("TRANSFER {$resrun}");
    $agi->verbose(basename(__FILE__) . ":" . __LINE__ . " - " . print_r($resrun, true));
}