添加呼叫队列拨打电话
This commit is contained in:
parent
95b22709a5
commit
30745a06cf
|
|
@ -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){
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,10 @@ return [
|
|||
'port' => 8022,
|
||||
],
|
||||
|
||||
'redis_key' => [
|
||||
'dial' => 'dial_uuid_queue',
|
||||
],
|
||||
|
||||
//队列响铃模式
|
||||
'strategy' => [
|
||||
'top-down' => '顺序振铃',
|
||||
|
|
|
|||
Loading…
Reference in New Issue