134,11 → 134,12 |
* Consolidated method for sending the given command to the server and returning |
* its reponse. Any failure in writing or reading will raise an exception. |
* |
* @param string $command The command to send |
* @param string $command The command to send |
* @param int $wait_timeout Number of seconds to wait for some response, default 5 seconds |
* |
* @return string |
*/ |
private function _sendCommand($command) |
private function _sendCommand($command, $wait_timeout = 5) |
{ |
if (!fwrite($this->_socket, $command)) { |
throw new Net_AsteriskManagerException( |
146,7 → 147,9 |
); |
} |
|
$response = stream_get_contents($this->_socket); |
for($count = 0; !$response && $count < $wait_timeout; ++$count, sleep(1)) { |
$response = stream_get_contents($this->_socket); |
} |
|
if ($response == false) { |
throw new Net_AsteriskManagerException( |