$line = array_shift($this->RxBuffer);\r
if ($line === NULL)\r
{\r
+ if (!$this->IsAlive())\r
+ {\r
+ return '';\r
+ }\r
usleep(250000);\r
}\r
else\r
\r
protected function TxData($cmd)\r
{\r
- $this->AmiInstance->SendAsyncAGICmd($this->GetRequest('agi_channel'), $cmd);\r
- return TRUE;\r
+ if (!$this->IsAlive())\r
+ {\r
+ return FALSE;\r
+ }\r
+ $result = $this->AmiInstance->SendAsyncAGICmd($this->GetRequest('agi_channel'), $cmd);\r
+ if ($result)\r
+ {\r
+ return TRUE;\r
+ }\r
+ else\r
+ {\r
+ return FALSE;\r
+ }\r
}\r
}\r
\r
//обработка комманды\r
protected function ProcessCmd($cmd)\r
{\r
- if (!$this->IsAlive())\r
+ if ($this->TxData($cmd) === FALSE)\r
{\r
+ $this->last_response = FALSE;\r
return FALSE;\r
}\r
-\r
- $this->TxData($cmd);\r
$line = $this->RxData();\r
$parse_result = preg_match('/(\d+)(?:.)(.*)/', $line, $parsed_line);\r
if ($parse_result === 1)\r