添加语音通话功能
|
|
@ -8,6 +8,7 @@ use App\Models\Department;
|
|||
use App\Models\Node;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Role;
|
||||
use App\Models\Sip;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
|
@ -140,7 +141,6 @@ class ApiController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//文件上传
|
||||
public function upload(Request $request)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\Chat;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Sip;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class AudioController extends Controller
|
||||
|
|
@ -12,8 +13,45 @@ class AudioController extends Controller
|
|||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data = Sip::with('user')->get();
|
||||
return View::make('chat.audio.index',compact('data'));
|
||||
$data = DB::table('sip')
|
||||
->join('user','sip.id','=','user.sip_id')
|
||||
->select(['user.nickname','sip.id','sip.username','sip.status','sip.state'])
|
||||
->get();
|
||||
$count = [
|
||||
'offline' => 0,
|
||||
'online' => 0,
|
||||
'down' => 0,
|
||||
'active' => 0,
|
||||
];
|
||||
foreach ($data as $d){
|
||||
$d->status_name = '';
|
||||
$d->class_name = '';
|
||||
if ($d->status==0){
|
||||
$count['offline']++;
|
||||
$d->status_name = '离线';
|
||||
$d->class_name = 'status-offline';
|
||||
}
|
||||
if ($d->status==1){
|
||||
$count['online']++;
|
||||
$d->status_name = '在线';
|
||||
$d->class_name = 'status-online';
|
||||
}
|
||||
if ($d->status==1 && $d->state=='down'){
|
||||
$count['down']++;
|
||||
$d->status_name = '空闲';
|
||||
$d->class_name = 'status-down';
|
||||
}
|
||||
if ($d->status==1 && $d->state=='active'){
|
||||
$count['active']++;
|
||||
$d->status_name = '通话中';
|
||||
$d->class_name = 'status-active';
|
||||
}
|
||||
}
|
||||
if ($request->ajax()){
|
||||
return $this->success('ok',['count'=>$count,'data'=>$data]);
|
||||
}
|
||||
return View::make('chat.audio.index',compact('count','data'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Cdr extends Migration
|
|||
$table->string('uuid')->comment('通话记录唯一ID');
|
||||
$table->string('aleg_uuid')->nullable()->comment('主叫ID');
|
||||
$table->string('bleg_uuid')->nullable()->comment('被叫ID');
|
||||
$table->unsignedBigInteger('department_id')->default(0)->comment('部门ID');
|
||||
$table->unsignedBigInteger('department_id')->default(0)->nullable()->comment('部门ID');
|
||||
$table->unsignedBigInteger('user_id')->default(0)->comment('用户ID');
|
||||
$table->unsignedBigInteger('sip_id')->default(0)->comment('分机ID');
|
||||
$table->string('department_name')->nullable()->comment('部门名称-冗余字段');
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
/** layuiAdmin.std-v1.0.0 LPPL License By http://www.layui.com/admin/ */
|
||||
/** layuiAdmin.std-v1.0.0 LPPL License By http://www.layui.com/admin/ */
|
||||
html #layuicss-layuiAdmin {
|
||||
display: none;
|
||||
position: absolute;
|
||||
|
|
@ -1417,3 +1417,4 @@ body,html{
|
|||
.layui-card-header{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,8 +167,6 @@
|
|||
})
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@yield('script')
|
||||
|
|
|
|||
|
|
@ -1,28 +1,85 @@
|
|||
@extends('base')
|
||||
|
||||
@section('content')
|
||||
<style>
|
||||
.offline{
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #707070;
|
||||
}
|
||||
.online{
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #FF9B00;
|
||||
}
|
||||
.down{
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #80CD0e;
|
||||
}
|
||||
.active{
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #FF2A00;
|
||||
}
|
||||
.status-offline{
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
margin-top: 4px;
|
||||
background: url("/layuiadmin/img/offline.png") no-repeat center center;
|
||||
}
|
||||
.status-online{
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
margin-top: 4px;
|
||||
background: url("/layuiadmin/img/online.png") no-repeat center center;
|
||||
}
|
||||
.status-down{
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
margin-top: 4px;
|
||||
background: url("/layuiadmin/img/down.png") no-repeat center center;
|
||||
}
|
||||
.status-active{
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
margin-top: 4px;
|
||||
background: url("/layuiadmin/img/active.png") no-repeat center center;
|
||||
}
|
||||
</style>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header layuiadmin-card-header-auto">
|
||||
|
||||
<div class="layui-row" id="count">
|
||||
<div class="layui-col-xs1">
|
||||
<p><span class="offline">{{$count['offline']}}</span>离线</p>
|
||||
</div>
|
||||
<div class="layui-col-xs1">
|
||||
<p><span class="online">{{$count['online']}}</span>在线</p>
|
||||
</div>
|
||||
<div class="layui-col-xs1">
|
||||
<p><span class="down">{{$count['down']}}</span>空闲</p>
|
||||
</div>
|
||||
<div class="layui-col-xs1">
|
||||
<p><span class="active">{{$count['active']}}</span>通话中</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-row layui-col-space10" style="min-height: 400px;">
|
||||
@foreach($data as $d)
|
||||
<div class="layui-col-md2 extension-item" extension-id="{{$d->id}}">
|
||||
<div class="layui-col-md2 extension-item" id="sipbox_{{$d->id}}">
|
||||
<div style="border: 1px solid rgb(204, 204, 204)">
|
||||
<div style="padding: 6px">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md4">
|
||||
<img class="status-img" style="margin-top: 4px" src="/layuiadmin/img/status_1.png" alt="">
|
||||
<div class="layui-col-md5">
|
||||
<img class="status-offline">
|
||||
</div>
|
||||
<div class="layui-col-md8">
|
||||
<p>分机:1001</p>
|
||||
<p>状态:<span class="status-txt">空闲</span></p>
|
||||
<div class="layui-col-md7">
|
||||
<p>用户:{{$d->nickname}}</p>
|
||||
<p>分机:{{$d->username}}</p>
|
||||
<p>状态:<span class="status-txt">{{$d->status_name}}</span></p>
|
||||
<p>
|
||||
监听:
|
||||
<a onclick="chanspy({{$d->username}},1);" title="客户听不到监听者说话(常用)" style="cursor: pointer">密语</a>
|
||||
<a onclick="chanspy({{$d->username}},2);" title="只能听" style="cursor: pointer">旁听</a>
|
||||
<a onclick="chanspy({{$d->username}},3);" title="三方正常通话" style="cursor: pointer">强插</a>
|
||||
<button type="button" class="layui-btn layui-btn-sm" onclick="call({{$d->username}});">发起呼叫</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -31,18 +88,6 @@
|
|||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<style>
|
||||
.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}
|
||||
.pagination>li{display:inline}
|
||||
.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}
|
||||
.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}
|
||||
.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}
|
||||
.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}
|
||||
.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}
|
||||
.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}
|
||||
</style>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -58,8 +103,23 @@
|
|||
var layer = layui.layer;
|
||||
var form = layui.form;
|
||||
var table = layui.table;
|
||||
|
||||
|
||||
function getSipStatus() {
|
||||
$.get("", function(res) {
|
||||
//更新统计数据
|
||||
$(".offline").text(res.data.count.offline);
|
||||
$(".online").text(res.data.count.online);
|
||||
$(".down").text(res.data.count.down);
|
||||
$(".active").text(res.data.count.active);
|
||||
//更新分机状态和状态图片
|
||||
res.data.data.forEach(function (item,index) {
|
||||
let _sip = $("#sipbox_"+item.id)
|
||||
_sip.find("img").attr("class",item.class_name);
|
||||
_sip.find(".status-txt").text(item.status_name)
|
||||
})
|
||||
setTimeout(getSipStatus,5000)
|
||||
})
|
||||
}
|
||||
getSipStatus();
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -324,9 +324,6 @@ Route::group(['prefix'=>'chat','namespace'=>'Chat','middleware'=>['auth','permis
|
|||
//语音通话
|
||||
Route::group([],function (){
|
||||
Route::get('audio','AudioController@index')->name('chat.audio')->middleware('permission:chat.audio');
|
||||
//更新数据
|
||||
Route::post('audio/update','AudioController@update')->name('chat.audio.update')->middleware('permission:chat.audio');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||