/** * 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); }
/** * 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); }