From 3d01239cf792a7365fe68b48fe429a9120cb2a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E6=9D=8E?= <712120393@qq.com> Date: Tue, 16 Mar 2021 22:51:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/SwooleDial.php | 9 ++------- app/Service/EslListen.php | 31 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 app/Service/EslListen.php diff --git a/app/Console/Commands/SwooleDial.php b/app/Console/Commands/SwooleDial.php index 2ad4f483..8362d803 100644 --- a/app/Console/Commands/SwooleDial.php +++ b/app/Console/Commands/SwooleDial.php @@ -6,7 +6,7 @@ use App\Models\Cdr; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Redis; -use function \Swoole\Coroutine\run; +use App\Service\EslListen; class SwooleDial extends Command { @@ -44,14 +44,9 @@ class SwooleDial extends Command \Swoole\Coroutine\run(function (){ $key = config('freeswitch.redis_key.dial'); while ($uuid = Redis::blpop($key)) { - $cdr = Cdr::query()->where('uuid','=',$uuid)->first(); - if ($cdr == null){ - Log::info(sprintf("通话记录[%s]不存在",$uuid)); - continue; - } //开户协程发起通话并监听 \Swoole\Coroutine::create(function () use ($uuid){ - + (new EslListen($uuid))->run(); }); } }); diff --git a/app/Service/EslListen.php b/app/Service/EslListen.php new file mode 100644 index 00000000..b467b572 --- /dev/null +++ b/app/Service/EslListen.php @@ -0,0 +1,31 @@ +where('uuid','=',$uuid)->first(); + if ($cdr == null) { + Log::info(sprintf("通话记录[%s]不存在",$uuid)); + return false; + } + + } + + public function run() + { + + } + +}