Пример #1
0
 function OnDTMF($tone)
 {
     switch ($tone) {
         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;
 }
Пример #2
0
 /**
  * Create an IVR instance by name, used internally only
  * @param $ivrname Name of the IVR to create
  * @return Newly created IVR object
  */
 private static function CreateIVR($ivrname)
 {
     global $yate_ivr_register;
     IVR::InitIVR();
     if (isset($yate_ivr_register[$ivrname])) {
         $obj = new $yate_ivr_register[$ivrname]();
         $obj->ivrname = $ivrname;
         return $obj;
     }
     Yate::Output("IVR: Requested unknown IVR '{$ivrname}'");
     return null;
 }
Пример #3
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));
}