Пример #1
0
 /**
  * Constructor.
  *
  * @param ResultInterface $result Result to decorate
  */
 public function __construct(ResultInterface $result)
 {
     parent::__construct($result);
     if ($result->isResult(-2)) {
         throw new ExecuteCommandException('Failed to execute');
     }
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param ResultInterface $result Result to decorate
  */
 public function __construct(ResultInterface $result)
 {
     parent::__construct($result);
     $this->digits = false;
     $this->timeout = false;
     $result = $result->getResult();
     switch ($result) {
         case -1:
             throw new ChannelDownException();
             break;
         case 0:
             $this->timeout = true;
             break;
         default:
             $this->digits = chr(intval($result));
             break;
     }
 }
Пример #3
0
 /**
  * Constructor.
  *
  * @param ResultInterface $result Result to decorate
  */
 public function __construct(ResultInterface $result)
 {
     parent::__construct($result);
     $data = $result->getData();
     $this->endpos = 0;
     $this->hangup = strpos($data, 'hangup') !== false;
     $this->waitfor = strpos($data, 'waitfor') !== false;
     $this->writefile = strpos($data, 'writefile') !== false;
     $this->dtmf = strpos($data, 'dtmf') !== false;
     if ($this->dtmf) {
         $this->digits = chr($result->getResult());
     }
     if ($this->writefile || $this->waitfor) {
         throw new RecordException($data);
     }
     $data = explode('=', $data);
     if (isset($data[1])) {
         $this->endpos = $data[1];
     }
 }