Skip to content

Commit

Permalink
重大更新:增加AEC支持,可以与服务端交互了
Browse files Browse the repository at this point in the history
  • Loading branch information
elesos committed Jun 20, 2019
1 parent c7f9ca3 commit cbb2555
Show file tree
Hide file tree
Showing 24 changed files with 195 additions and 60 deletions.
Binary file modified do-not-support-web/chatDBServer
Binary file not shown.
Binary file modified do-not-support-web/chatRoomServer
Binary file not shown.
Binary file modified do-not-support-web/groupServer
Binary file not shown.
Binary file modified do-not-support-web/liveProxyServer
Binary file not shown.
Binary file modified do-not-support-web/liveSrcServer
Binary file not shown.
Binary file modified do-not-support-web/liveVdnServer
Binary file not shown.
Binary file modified do-not-support-web/msgServer
Binary file not shown.
3 changes: 3 additions & 0 deletions do-not-support-web/starrtc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#打开下面注释表示开启aec功能
#aecurl=https://www.starrtc.com/aec/eventCenter.php

Binary file modified do-not-support-web/videoRecServer
Binary file not shown.
Binary file modified do-not-support-web/voipServer
Binary file not shown.
37 changes: 0 additions & 37 deletions server-api/server-api-php/authKey.php

This file was deleted.

5 changes: 1 addition & 4 deletions server-api/server-api-php/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@ function_exists("date_default_timezone_set")?date_default_timezone_set("Asia/Sha
require_once($api_config_dir . '/include/pubFun.php');



define('appid', 'your appid');
define('secret', 'your secret');
define('guardToken', 'your guardToken');
define('log_file', $api_config_dir . '/log.txt');
191 changes: 178 additions & 13 deletions server-api/server-api-php/eventCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@


$data = rawurldecode(array_key_exists('data', $_REQUEST) ? $_REQUEST['data'] : 0);
$sign = rawurldecode(array_key_exists('sign', $_REQUEST) ? $_REQUEST['sign'] : 0);
if(empty($data) || empty($sign)){
if(empty($data)){
echo_0('missing args');
}

Expand All @@ -24,34 +23,200 @@
echo_0('invalid data');
}

$signstr = generateSign($data, guardToken);
if(strcasecmp($sign, $signstr)){
echo_0('invalid sign');
}

$action = array_key_exists('action', $dataArr) ? $dataArr['action'] : 0;
if(empty($action)){
echo_0('action is empty');
}
$groupId = array_key_exists('groupId', $dataArr) ? $dataArr['groupId'] : 0;

//=========================VOIP(一对一)事件通知==================
//https://docs.starrtc.com/zh-cn/docs/aec-voip.html
if(!strcasecmp($action, 'AEC_VOIP_USER_ONLINE')){
//TODO
logf("申请voip通话");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_VOIP_USER_PLAYING')){
//TODO
logf("voip通话正在进行中");
echo_1('success');
}


if(!strcasecmp($action, 'AEC_ACCESS_VALIDATION')){//接入验证
echo_1($dataArr['echostr']);
if(!strcasecmp($action, 'AEC_VOIP_USER_HANGUP')){
//TODO
logf("voip挂断");
echo_1('success');
}



//===================群事件通知===============
// https://docs.starrtc.com/zh-cn/docs/aec-group.html
if(!strcasecmp($action, 'AEC_GROUP_CREATE')){
echo_0('err msg');
//TODO
logf("创建群");
echo_0('没有权限');
}

if(!strcasecmp($action, 'AEC_GROUP_SYNC_ALL')){
//TODO
logf("同步全部群成员");
echo_0('没有权限');
}



if(!strcasecmp($action, 'AEC_GROUP_DEL')){
echo_0('err msg');
//TODO
logf("删除群");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_GROUP_ADD_USER')){
//TODO
logf("新增群成员");
echo_1('success');
}


if(!strcasecmp($action, 'AEC_GROUP_ADD_USER_AND_SYNC_ALL')){
//TODO
logf("新增群成员并同步全部群成员");
echo_0('没有权限');
}

if(!strcasecmp($action, 'AEC_GROUP_REMOVE_USER')){
//TODO
logf("删除群成员");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_GROUP_REMOVE_USER_AND_SYNC_ALL')){
//TODO
logf("删除群成员并同步全部群成员");
echo_0('没有权限');
}


if(!strcasecmp($action, 'AEC_SET_GROUP_PUSH_IGNORE')){
//TODO
logf("设置免打扰");
echo_1('success');
}


if(!strcasecmp($action, 'AEC_SET_GROUP_PUSH_IGNORE_AND_SYNC_ALL')){
//TODO
logf("设置免打扰模式并同步群成员");
echo_0('没有权限');
}


if(!strcasecmp($action, 'AEC_UNSET_GROUP_PUSH_IGNORE')){
//TODO
logf("取消免打扰");
echo_1('success');
}


if(!strcasecmp($action, 'AEC_UNSET_GROUP_PUSH_IGNORE_AND_SYNC_ALL')){
//TODO
logf("取消免打扰并同步群成员");
echo_0('没有权限');
}


//==============================直播事件通知========================
//https://docs.starrtc.com/zh-cn/docs/aec-live.html
if(!strcasecmp($action, 'AEC_LIVE_CREATE_CHANNEL_GLOBAL_PUBLIC')){
//TODO
logf("创建GLOBAL_PUBLIC直播流");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_LIVE_CREATE_CHANNEL_LOGIN_PUBLIC')){
//TODO
logf("创建LOGIN_PUBLIC直播流");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_LIVE_CREATE_CHANNEL_GROUP_PUBLIC')){
//TODO
logf("创建GROUP_PUBLIC直播流");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_LIVE_APPLY_UPLOAD_CHANNEL')){
//TODO

logf("申请上传");
echo_0('没有权限');
}

if(!strcasecmp($action, 'AEC_LIVE_SET_CHANNEL_UPLOADER')){
//TODO

logf("设置上传者");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_LIVE_UNSET_CHANNEL_UPLOADER')){
//TODO

logf("取消上传权限");
echo_1('success');
}


if(!strcasecmp($action, 'AEC_LIVE_UPLOADER_DISCONNECT')){
//TODO

logf("上传者断开连接(离开)");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_LIVE_UPLOADER_UPLOADING')){
//TODO

logf("上传者正在上传");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_LIVE_CLOSE_CHANNEL')){
//TODO

logf("关闭直播流");
echo_1('success');
}
// TODO:process other actions

if(!strcasecmp($action, 'AEC_LIVE_DELETE_CHANNEL')){
//TODO

logf("删除直播流");
echo_1('success');
}


if(!strcasecmp($action, 'AEC_LIVE_USER_ONLINE')){
//TODO

logf("用户开始观看直播");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_LIVE_USER_PLAYING')){
//TODO

logf("用户观看直播中");
echo_1('success');
}

if(!strcasecmp($action, 'AEC_LIVE_USER_OFFLINE')){
//TODO

logf("用户停止观看直播");
echo_1('success');
}

echo_0('unkown action:'.$action);
16 changes: 10 additions & 6 deletions server-api/server-api-php/include/pubFun.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php

function generateSign($data, $guardToken){
return base64_encode(hash_hmac('sha1', $data, $guardToken, TRUE));
}


function echo_1($data, $exit = 1){
$retArr = array('status' => 1, 'data' => $data);
$retArr = array('status' => '1', 'data' => $data);
$json = json_encode($retArr);
echo $json;
if($exit == 1){
Expand All @@ -14,13 +12,19 @@ function echo_1($data, $exit = 1){
}

function echo_0($data, $exit = 1){
$retArr = array('status' => 0, 'data' => $data);
$retArr = array('status' => '0', 'data' => $data);
$json = json_encode($retArr);
echo $json;
if($exit == 1){
exit;
}
}


function logf($data){
$fp = fopen(log_file, "a+");//读写方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建之。
$time = date('Y-m-d H:i:s');
fwrite($fp, $time.' '.$data."\r\n");//记得a+w
fclose($fp);

}

Binary file modified web-supported/chatDBServer
Binary file not shown.
Binary file modified web-supported/chatRoomServer
Binary file not shown.
Binary file modified web-supported/groupServer
Binary file not shown.
Binary file modified web-supported/liveProxyServer
Binary file not shown.
Binary file modified web-supported/liveSrcServer
Binary file not shown.
Binary file modified web-supported/liveVdnServer
Binary file not shown.
Binary file modified web-supported/msgServer
Binary file not shown.
3 changes: 3 additions & 0 deletions web-supported/starrtc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#打开下面注释表示开启aec功能
#aecurl=https://www.starrtc.com/aec/eventCenter.php

Binary file modified web-supported/videoRecServer
Binary file not shown.
Binary file modified web-supported/voipServer
Binary file not shown.

0 comments on commit cbb2555

Please sign in to comment.