# AI能力
# 1. 设置AI配置
可以设置的配置如下:
capabilityServer - Ai服务http地址,例如http://192.168.17.172:8087
resourceServer - Ai服务http地址,可为空,例如http://192.168.17.172:8287
portalServer - 双录portal地址,可为空,例如http://192.168.4.171:18530
portalToken - 双录portal,可为空,token
示例代码:
var webPlugin = new WebPlugin();
function SetAiConfig(server) {
webPlugin.SetAiConfig(server, "", "", "");
}
其他设置
this.AiConfig = {
Tts: {
Factory: "juphoon",
Quality: 2,
Speed: 2,
Volume: 2,
SecretId: "",
SecretKey: "",
Server: ""
},
Asr: {
Factory: "baidu",
SecretId: "",
SecretKey: "",
Server: "",
AsrType: "shortSpeech",
SampleRate: 16000,
},
OcrIdcard: {
Factory: "baidu",
SecretId: "",
SecretKey: "",
Server: ""
},
HouseholdBook: {
Factory: "juphoon",
SecretId: "",
SecretKey: "",
Server: ""
},
OcrCommon: {
Factory: "juphoon",
SecretId: "",
SecretKey: "",
Server: ""
},
ActionDetect: {
Factory: "juphoon",
SecretId: "",
SecretKey: "",
Server: ""
},
FaceCompare: {
Factory: "juphoon",
SecretId: "",
SecretKey: "",
Server: "",
ImageProcCallback: "",
CustomParams: {
// "key1": "value1"
}
},
FaceDetect: {
Factory: "juphoon",
Interval: 1500,
Occlusion: 0.1,
SecretId: "",
SecretKey: "",
Server: ""
}
}
示例代码:
function SetAiConfig(server) {
...
webAgent.AiConfig.FaceDetect = faceDetect;
...
webAgent.SetAiConfig(server, "", "", "");
}
# 2. 人脸检测
# 开启/关闭人脸检测
设置检测人,一定时间周期内将会将测一次,周期可设置。
示例代码:
var webPlugin = new WebPlugin();
/**
* @desc 开启人脸数量检测 通过OnFaceDetectNotify
* @param {Boolean} enable - true-开启/false-关闭
* @param {Array} users - 检测成员列表,例如[agent1,agent2];默认传空,全员检测
* @param period 设备检测周期,单位毫秒,建议2000毫秒
*/
webPlugin.EnableFaceDetect(enable, users, period);
# 人脸检测结果上报
/**
* @desc 人脸数量上报通知
*
* @param {String} userId
* @param {Number} faceNum userId对应视频画面中的人脸数量(只有数目发生变化的时候才会通知)
* @param {String} detail 通知详情 json字符串
*/
webPlugin.OnFaceDetectNotify = function (userId, faceNum, detail) {
console.log('OnFaceDetectNotify', userId, faceNum, detail);
};
# 集成
(1)调用SetAiConfig设置服务器地址,例如http://192.168.17.172:8087
(2)进入通话后开启人脸检测
var userArray = []
userArray.push("agent1")
userArray.push("guest1")
webAgent.EnableFaceDetect(true, userArray, 2000);
备注:userArray传入需要检测的userId,若传入空,则检测会议中所有成员
(3)通过OnFaceDetectNotify获得视频画面中的人脸数量,只有数目发生变化的时候才会通知。
集成时可通过人脸数量变化来判断人脸出框或人脸闯入。 例如1->0 人脸出框 1->2人脸闯入
(4)关闭人脸检测
a. 调用接口关闭
webAgent.EnableFaceDetect(false, userArray, 2000);
b. 通话结束后自动关闭
# 发起一次人脸检测
发起一次人脸检测 通过OnFaceDetectResult返回结果
示例代码:
var webPlugin = new WebPlugin();
/**
* @param taskId 任务号,用于对应OnOnFaceDetectResult上报的人脸检测检测结果
* @param {Object} sourceImage 基准图 {"Type":"LocalPath/RemoteUrl/Base64/Stream","Value":""}
* Type为LocalPath时 Value为本地图片路径
* Type为RemoteUrl时 Value为远程图片地址
* Type为Base64时 Value为图片Base64数据
* Type为Stream时 Value为会议成员UserId;特殊标识Self,检测自己
*/
webPlugin.RequestFaceDetect(taskId, sourceImage);
通知上报示例代码:
/**
* @desc 单次人脸检测结果
* @param taskId 指令id,与RequestFaceDetect对应
* @param result 检测是否成功
* @param content 人脸检测内容
* @param imageUrl 检测图片url
* @constructor
*/
webPlugin.OnFaceDetectResult = function(taskId, result, content, imageUrl) {}
# 3. TTS
# 生成tts
备注: 需要先调用SetAiConfig设置服务器地址,例如http://192.168.17.172:8087
var webPlugin = new WebPlugin();
/**
* @desc TTS语音
* @param {String} taskId - 任务号,唯一
* @param {String} url - 转换地址
* @param {String} content - TTS转换内容
* @param {String} supplierType - 厂商类型 juphoon(菊风) baidu(百度) ali-private(阿里)
* @param {String} dirType - 存放文件目录,如果传空则默认存放在 cache 目录
* @param {Number} speed - 音频生成语速 1 -> 5(慢->快)
* @param {Object} customParams - 生成tts自定义参数 例如{"pt.speed": "300"}
*/
webPlugin.GetTTS(taskId, content, supplierType, dirType, speed, customParams);
# 生成tts结果上报
/**
* @desc TTS语音获取结果回调
* @param {boolean} result true/false
* @param {String} taskId 任务号
* @param {String} serverUrl result为true时,http本地服务访问路径
* @param {String} localPath result为true时,TTS文件保存的本地路径
* @param {String} reason result为false时,失败原因
*/
webPlugin.OnTTSResult = function (result, taskId, serverUrl, localPath, reason) {
console.log('OnTTSResult', result, taskId, serverUrl, localPath, reason);
}
# 4. 语音识别
# 初始化
初始化asr
var webPlugin = new WebPlugin();
webPlugin.InitAsr();
# 销毁
销毁asr
var webPlugin = new WebPlugin();
webPlugin.DestroyAsr();
# 开启/关闭
开启/关闭asr
var webPlugin = new WebPlugin();
/**
* @desc 开启/关闭asr
* @param enable 开启/关闭 enable为false时通过OnAsrRecognitionResult上报asr识别结果
* @param taskId 任务号,enable为true时调用,可选,用于对应OnAsrRecognitionResult上报的asr结果
* @param timeout 单位毫秒,enable为true时调用,可选(若大于0,插件在收到enable false命令后再收集timeout时间段内的asr结果,一定程度上避免数据丢失)
* @constructor
*/
webPlugin.EnableAsr(enable, taskId, timeout);
开启关闭语音识别结果的事件通知
通知上报内容:
taskId 指令id,与EnableAsr对应
content asr识别内容
webPlugin.OnAsrRecognitionResult = function (taskId, content, replayUrl) {
console.log('OnAsrRecognitionResult', taskId, content, replayUrl);
}
# 是否可用通知
语音识别功能是否可用将会通过OnAsrAvailableNotify上报,available 是否可用 true/false
webPlugin.OnAsrAvailableNotify = function (available) {
console.log('OnAsrAvailableNotify', available);
}
# 5. OCR图文识别
# 开启OCR检测
可加测:身份证正面IdcardFront 身份证反面IdcardBack;
可选定检测人员:检测成员 self-检测自己
任务号:对应事件上报
/**
* @desc 开启OCR检测 通过OnOcrDetectResult获取结果
* @param taskId 任务号,enable为true时调用,可选,用于对应OnOcrDetectResult上报的asr结果
* @param {Boolean} enable - true-开启/false-关闭
* @param {String} user - 检测成员 Self-检测自己
* @param {String} type - 检测类型 身份证正面IdcardFront 身份证反面IdcardBack 户口本HouseholdBook
* @param timeout 检测时长 毫秒
*/
webPlugin.EnableOcrDetect(taskId, enable, user, type, timeout);
ocr识别结果事件上报:
taskId 指令id,与EnableFaceDetect对应
result 检测是否成功
content ocr识别内容
lastFramePath 识别过程中最后一帧图片地址
lastFrameUrl 识别过程中最后一帧图片http链接
示例代码:
webPlugin.OnOcrDetectResult = function (taskId, result, content, lastFramePath, lastFrameUrl) {
console.log('OnOcrDetectResult', taskId, result, content, lastFramePath, lastFrameUrl);
}
# 通用ocr检测
taskId 任务号,用于对应OnCommonOcrResult上报的人脸对比结果;
sourceImage 基准图 {"Type":"LocalPath/RemoteUrl/Base64/Stream","Value":""}
Type为LocalPath时 Value为本地图片路径
Type为RemoteUrl时 Value为远程图片地址
Type为Base64时 Value为图片Base64数据
Type为Stream时 Value为会议成员UserId;特殊标识Self,检测自己
webPlugin.RequestCommonOcr(taskId, sourceImage) ;
识别结果通过OnCommonOcrResult上报:
taskId 指令id,与RequestCommonOcr对应
result 检测是否成功
content ocr文本内容
imageUrl 检测图片url
webPlugin.OnCommonOcrResult = function (taskId, result, content, imageUrl) {
console.log('OnCommonOcrResult', taskId, result, content, imageUrl);
}
# 6. 人脸对比
# 发起人脸对比
发起人脸对比,通过OnFaceCompareResult获取结果;
taskId 任务号,用于对应OnFaceCompareResult上报的人脸对比结果
imageSource - {"Type":"LocalPath/RemoteUrl/Base64/Stream","Value":""}
Type为LocalPath时 Value为本地图片路径
Type为RemoteUrl时 Value为远程图片地址
Type为Base64时 Value为图片Base64数据
Type为Stream时 Value为会议成员UserId;特殊标识Self,检测自己
webPlugin.RequestFaceCompare(taskId, imageSource1, imageSource2);
# 人脸对比识别结果
/**
* @desc 人脸对比识别结果
* @param taskId 指令id,与EnableFaceDetect对应
* @param result 检测是否成功
* @constructor
*/
webPlugin.OnFaceCompareResult = function (taskId, result) {
console.log('OnFaceCompareResult', taskId, result);
}
# 7. 签字动作检测
# 发起签字动作检测
签字动作检测,通过OnActionDetectResult获取结果:
taskId 任务号,用于对应OnActionDetectResult上报的动作识别结果;
sourceImage 基准图 {"Type":"LocalPath/RemoteUrl/Base64/Stream","Value":""}
Type为LocalPath时 Value为本地图片路径、
Type为RemoteUrl时 Value为远程图片地址、
Type为Base64时 Value为图片Base64数据、
Type为Stream时 Value为会议成员UserId;特殊标识Self,检测自己
webPlugin.RequestActionDetect(taskId, sourceImage);
# 签字动作检测结果
taskId 指令id,与RequestActionDetect对应
/**
* @desc 签字动作检测结果
* @param taskId 指令id,与RequestActionDetect对应
* @param result 检测是否成功
* @param imageUrl 检测图片url
* @constructor
*/
webPlugin.OnActionDetectResult = function (taskId, result, imageUrl) {
console.log('OnActionDetectResult', taskId, result, imageUrl);
}
# HTTP服务
初始化插件成功后,插件将会通过事件上报返回http服务端口(具体参数插件初始化模块)。通过地址拼接可以请求插件的http服务。
# 1. 获取话单列表(支持分页,查询条件)
接口地址:localhost:10001/record/bill?pageNumber={pageNumber}&pageSize={pageSize}eNum=
请求方式:POST
Params 参数:
字段 | 类型 | 说明 | 是否必填 |
---|---|---|---|
pageNumber | int | 请求页序号 | 否 |
pageSize | int | 每页 | 否 |
Body参数:
# minStartTime: 起始开始时间 -13位时间戳(毫秒)
# maxStartTime: 起始结束时间 - 13位时间戳(毫秒)
# minEndTime: 终止开始时间 -13位时间戳(毫秒)
# maxEndTime: 终止结束时间 -13位时间戳(毫秒)
# fileState: 录制文件状态
# serialId: 流水号,
# --流水号为空时,按条件查询,可返回多条数据
# --流水号不为空时,按流水号查询,返回对应流水号数据
{
"minStartTime": 1671180828000,
"maxStartTime": 1671180828000,
"minEndTime": 1671180828000,
"maxEndTime": 1671180828000,
"fileState": 1,
"serialId": "",
}
响应
{
"ret": 0,
"msg": "查询话单信息成功",
"data": {
"list": [
{
"id": "1",
"streamType": "Camera",
"appKey": "",
"server": "udp:192.168.4.171:10160",
"serialId": "WPPCWPPCq5l8hdn1ig1678155427358",
"orderId": "WPPCq5l8hdn1ig",
"extraInfo": "{\"reRecord\":false,\"kafakaData\":\"{\\\"recordSerialId\\\":\\\"WPPCq5l8hdn1ig\\\",\\\"recordId\\\":\\\"WPPCWPPCq5l8hdn1ig1678155427358\\\",\\\"meetingId\\\":\\\"\\\",\\\"comWordsCnt\\\":\\\"1、\\\\r\\\\n(人工话术1)常狗闻先生,您好!为规范销售从业人员的销售行为,也为了更好地保护您的合法权益,根据银保监会有关规定,我们将以录音录像方式对我的销售过程关键环节予以记录。请问您是否同意?林顺深圳80074239深圳分行普通定投销售(未超风销售)\\\\r\\\\n\\\\r\\\\n2、\\\\r\\\\n(人工话术2)需要提醒您的是,此次录音录像过程对于今后您维护权益非常关键,请您认真阅读您签署文件的具体内容,如实回答相关问题。如果我向您作出任何与书面文件内容不一致的承诺,建议您与我通过书面形式予以确认,以便更好地维护您的合法权益。我是招商银行深圳分行罗湖支行的赵威,这是我的工作证件,请您核对。\\\",\\\"isAI\\\":true,\\\"sysId\\\":\\\"WPPC\\\",\\\"stmtMod\\\":\\\"VIDEO\\\",\\\"keyWrdValue\\\":{\\\"CUSTGENDER\\\":\\\"女士\\\",\\\"AMOUNT\\\":\\\"200.01\\\",\\\"BLGCMNNM\\\":\\\"赵一威\\\",\\\"CCYNM\\\":\\\"元\\\",\\\"CUSTNM\\\":\\\"常狗闻20\\\",\\\"CUSTRSKGRD\\\":\\\"\\\",\\\"CUSTRSKGRDDES\\\":\\\"风险性\\\"},\\\"stmtCntntList\\\":[{\\\"stmtCntntSeqNbr\\\":1,\\\"stmtCntntTxt\\\":\\\"1、20220801 对接神笔话术 TTS语音播报TTS语音播报TTS语音播报#{CCYNM}#{PRDRSK}1222修改修改 222222\\\",\\\"prodTypCd\\\":\\\"OPNFND\\\",\\\"prodTypNm\\\":\\\"开放式基金\\\",\\\"awTaskId\\\":\\\"id1\\\",\\\"fileKey\\\":\\\"\\\",\\\"fileAdrr\\\":\\\"\\\",\\\"fileType\\\":\\\"VIDEO\\\",\\\"playVce\\\":\\\"RAW\\\"},{\\\"stmtCntntSeqNbr\\\":2,\\\"stmtCntntTxt\\\":\\\"2、20220801 这是一张图片,这是我的身份证件,请您核对?\\\\r\\\\n\\\\r\\\\n\\\",\\\"prodTypCd\\\":\\\"OPNFND\\\",\\\"prodTypNm\\\":\\\"开放式基金\\\",\\\"awTaskId\\\":\\\"\\\",\\\"fileKey\\\":\\\"\\\",\\\"fileAdrr\\\":\\\"http://localhost:{port}/file/test/video.mp4\\\",\\\"fileType\\\":\\\"VIDEO\\\",\\\"playVce\\\":\\\"RAW\\\"},{\\\"stmtCntntSeqNbr\\\":3,\\\"stmtCntntTxt\\\":\\\"3、#{CUSTNM}#{CUSTGENDER},在确认开通招商银行黄金账户业务前,需与您通过录音录像的方式确认以下内容:\\\\r\\\\n您将要开通的黄金账户业务在我行的风险评级为R3,即贵金属产品具有一定的资产配置属性或交易属性,整体风险适中,不保证本金和收益。您在我行的风险评级为#{CUSTRSKGRD} ,属于#{CUSTRSKGRDDES}客户,#{CUSTRSKCMPPRD}产品风险评级\\\",\\\"awTaskId\\\":\\\"id2\\\",\\\"prodTypCd\\\":\\\"OPNFND\\\",\\\"prodTypNm\\\":\\\"开放式基金\\\",\\\"fileKey\\\":\\\"111222333\\\",\\\"fileAdrr\\\":\\\"\\\",\\\"fileType\\\":\\\"VIDEO\\\",\\\"playVce\\\":\\\"TTS\\\"},{\\\"stmtCntntSeqNbr\\\":4,\\\"stmtCntntTxt\\\":\\\"4、这是一张截图图片,这是一张图片?\\\\r\\\\n\\\\r\\\\n\\\",\\\"awTaskId\\\":\\\"id3\\\",\\\"fileKey\\\":\\\"\\\",\\\"fileAdrr\\\":\\\"\\\",\\\"fileType\\\":\\\"VIDEO\\\",\\\"playVce\\\":\\\"RAW\\\"},{\\\"stmtCntntSeqNbr\\\":5,\\\"stmtCntntTxt\\\":\\\"5、这是一张截图图片\\\",\\\"fileKey\\\":\\\"334455\\\",\\\"fileAdrr\\\":\\\"http://localhost:{port}/file/test/image.png\\\",\\\"fileType\\\":\\\"IMAGE\\\",\\\"playVce\\\":\\\"TTS\\\"}],\\\"version\\\":\\\"1.0.8\\\",\\\"ip\\\":\\\"172.16.2.184\\\",\\\"PlayWithAI\\\":true}\",\"initTimeSpend\":1073,\"uploadState\":{\"url\":\"http://192.168.17.74:19999/services/v1/outward/uploadstate\",\"dblRcdSrlId\":\"WPPCq5l8hdn1ig\"}}",
"fileName": "20230307_101725_WPPCWPPCq5l8hdn1ig1678155427358.mp4",
"filePath": "D:\\Workspace\\web\\1.0\\BusinessWeb\\record\\2023-03\\2023-03-07\\WPPCWPPCq5l8hdn1ig1678155427358\\20230307_101725_WPPCWPPCq5l8hdn1ig1678155427358.mp4",
"fileState": 1,
"fileSize": 3585960,
"fileUid": "Record-024e1b7c-4d33-4818-8f5f-8a2336b8ce8b",
"transferSize": 0,
"date": "20230307",
"url": "",
"startRecordTime": 1678155445301,
"stopRecordTime": 1678155471168,
"sliceRecord": 0,
"isChoose": false
}
],
"total": 1
}
}