PHP Version 5
Author: Marcelo Gornstein (marcelog@gmail.com)
Inheritance: implements PAGI\Client\Result\IResult
Esempio n. 1
0
 /**
  * Returns a result object given a string (the agi result after executing
  * a command).
  *
  * @param unknown_type $text
  * @throws ChannelDownException
  * @throws InvalidCommandException
  *
  * @return Result
  */
 protected function getResultFromResultString($text)
 {
     if ($text == 'HANGUP') {
         throw new ChannelDownException(new Result('511 asterisk hangup'));
     }
     $result = new Result($text);
     switch ($result->getCode()) {
         case 200:
             return $result;
         case 511:
             throw new ChannelDownException($result);
         case 510:
         case 520:
         default:
             break;
     }
     throw new InvalidCommandException($result);
 }
Esempio n. 2
0
 /**
  * Returns a result object given a string (the agi result after executing
  * a command).
  *
  * @param unknown_type $text
  * @throws ChannelDownException
  * @throws InvalidCommandException
  *
  * @return Result
  */
 protected function getResultFromResultString($text)
 {
     $result = new Result($text);
     switch ($result->getCode()) {
         case 200:
             return $result;
         case 511:
             throw new ChannelDownException($result);
         case 510:
         case 520:
         default:
             break;
     }
     throw new InvalidCommandException($result);
 }