From 4d5b386cbf50596faee6386acd06fa90baf43f28 Mon Sep 17 00:00:00 2001 From: sleepy Date: Tue, 8 Sep 2020 15:24:59 +1000 Subject: [PATCH] =?utf8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?utf8?q?=D0=BD=20=D0=B1=D0=B0=D0=B3=20=D0=B2=20=D1=80=D0=B5=D0=B7=D1=83?= =?utf8?q?=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=B5=20=D0=BA=D0=BE=D1=82=D0=BE?= =?utf8?q?=D0=B3=D0=BE=D1=80=D0=BE=20AsyncAGI=20=D0=BC=D0=BE=D0=B3=D0=BB?= =?utf8?q?=D0=BE=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=BD=D1=83=D1=82=D1=8C?= =?utf8?q?=20=D0=B2=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B5=20=D0=B5=D1=81?= =?utf8?q?=D0=BB=D0=B8=20=D0=BD=D0=B0=20=D0=BA=D0=B0=D0=BD=D0=B0=D0=BB?= =?utf8?q?=D0=B5=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=20=D1=83=D0=B6=D0=B5=20?= =?utf8?q?=D0=B7=D0=B0=D0=B2=D0=B5=D1=80=D1=88=D0=B8=D0=BB=D1=81=D1=8F=20?= =?utf8?q?=D0=B8=20=D0=B8=20AsyncAGI=20=D1=83=D0=B6=D0=B5=20=D0=B7=D0=B0?= =?utf8?q?=D0=B2=D0=B5=D1=80=D1=88=D1=91=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- astapilib/baseagi.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/astapilib/baseagi.php b/astapilib/baseagi.php index da7fbc5..732705f 100644 --- a/astapilib/baseagi.php +++ b/astapilib/baseagi.php @@ -54,6 +54,10 @@ trait callioAGI $line = array_shift($this->RxBuffer); if ($line === NULL) { + if (!$this->IsAlive()) + { + return ''; + } usleep(250000); } else @@ -66,8 +70,19 @@ trait callioAGI protected function TxData($cmd) { - $this->AmiInstance->SendAsyncAGICmd($this->GetRequest('agi_channel'), $cmd); - return TRUE; + if (!$this->IsAlive()) + { + return FALSE; + } + $result = $this->AmiInstance->SendAsyncAGICmd($this->GetRequest('agi_channel'), $cmd); + if ($result) + { + return TRUE; + } + else + { + return FALSE; + } } } @@ -119,12 +134,11 @@ trait baseAGI //обработка комманды protected function ProcessCmd($cmd) { - if (!$this->IsAlive()) + if ($this->TxData($cmd) === FALSE) { + $this->last_response = FALSE; return FALSE; } - - $this->TxData($cmd); $line = $this->RxData(); $parse_result = preg_match('/(\d+)(?:.)(.*)/', $line, $parsed_line); if ($parse_result === 1) -- 2.39.5