添加呼叫队列拨打电话

This commit is contained in:
老李 2021-03-16 22:31:44 +08:00
parent 95b22709a5
commit 30745a06cf
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,59 @@
<?php
namespace App\Console\Commands;
use App\Models\Cdr;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;
use function \Swoole\Coroutine\run;
class SwooleDial extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'swoole:dial';
/**
* The console command description.
*
* @var string
*/
protected $description = '呼叫队列';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
\Swoole\Coroutine\run(function (){
$key = config('freeswitch.redis_key.dial');
while ($uuid = Redis::bPop($key)) {
$cdr = Cdr::query()->where('uuid','=',$uuid)->first();
if ($cdr == null){
Log::info(sprintf("通话记录[%s]不存在",$uuid));
continue;
}
//开户协程发起通话并监听
\Swoole\Coroutine::create(function () use ($uuid){
});
}
});
}
}

View File

@ -39,6 +39,10 @@ return [
'port' => 8022,
],
'redis_key' => [
'dial' => 'dial_uuid_queue',
],
//队列响铃模式
'strategy' => [
'top-down' => '顺序振铃',