ucservice 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3107 +0,0 @@
1
- /**
2
- * SCOOPER Dispatch JavaScript library
3
- * browser support: IE8+, Chrome, FireFox
4
- * 3rd-part library request: require.js, cometd.js, jquery
5
- * scooper library request: scooper.sse.js, scooper.util.js
6
- *
7
- * @author jiangwj 2016-04
8
- */
9
- (function (window, factory) {
10
- if (typeof define === 'function' && define.amd) {
11
- define('scooper.dispatch', ['jquery', 'scooper.sse'], factory);
12
- } else if (typeof module === 'object' && module.exports) {
13
- module.exports = window.document ?
14
- factory(jQuery, scooper.sse) :
15
- factory(require('jquery'), require('scooper.sse'));
16
- } else {
17
- factory(jQuery, scooper.sse);
18
- }
19
- }(typeof window !== 'undefined' ? window : this, function($, scooper_sse) {
20
- 'use strict';
21
-
22
- // 使用方法一:(所有框架同域名)
23
- //
24
- // 初始化
25
- // 在顶层框架中调用:
26
- // scooper.dispatch.initialize("main");
27
- // 在下层框架中调用:
28
- // scooper.dispatch.initialize("sub");
29
- //
30
- // 设置服务端连接
31
- // 在顶层框架中调用:
32
- // scooper.dispatch.login(user,pass);
33
- // 或(如果在后台已经建立连接,并返回token,则直接设置token,无需调用login)
34
- // scooper.dispatch.setToken(token);
35
-
36
- // 在多框架(frame)程序中,确保所有框架内仅使用一路调度API;(置于顶层框架中)
37
- // 如果顶层框架中不存在 scooper.dispatch 的注册,并且与当前框架不在同一个域名中;则直接在本页面中使用。
38
- // (考虑到第三方公司项目使用 iframe 内嵌我司调度网页)
39
- // 各框架之间应该使用 window.postMessage 来进行通信。
40
-
41
- // 判断是否处于顶层框架
42
- if (!scooper.util.isTopFrame()) {
43
- // 如果在下层框架,则找到顶层框架
44
- // TODO 使用 DispatchProxy 来向顶层框架转发消息来调用调度相关功能;顶层框架中对这些消息进行处理
45
- // var topFrame = scooper.util.findTopFrame();
46
- // // 如果顶层框架中存在 scooper.sse 则直接使用该对象
47
- // if (typeof(topFrame.window.scooper) != "undefined" && topFrame.window.scooper.dispatch) {
48
- // return window.scooper.dispatch = topFrame.window.scooper.dispatch;
49
- // }
50
- }
51
- // 判断当前页面是否引入过 scooper.util
52
- if (typeof(scooper.util) == "undefined") throw new Error('scooper.util.js is required!');
53
- // 判断是否成功导入 scooper.sse
54
- if (!scooper_sse) throw new Error('scooper.sse.js is required!');
55
-
56
- // 如果与调度网页后台处于不同域名,则需要设置该值
57
- var remoteBaseUrl = null;
58
- function getBaseUrl() {
59
- return remoteBaseUrl ? remoteBaseUrl : scooper.util.baseUrl;
60
- }
61
-
62
- function apiUrl(path) {
63
- return getBaseUrl() + 'api' + path;
64
- }
65
-
66
-
67
- function _groupUrl(path) {
68
- return getBaseUrl() + 'data/group' + path;
69
- }
70
-
71
- function _loadJson(url,param,retfn,async) {
72
- if (param && typeof(param['token']) == 'undefined') {
73
- if(window.top.token != ""){
74
- param['token'] = window.top.token;
75
- } else {
76
- param['token'] = window.token;
77
- }
78
- }
79
- async = (async == undefined? true:false);
80
- //
81
- $.ajax({
82
- 'method': 'POST',
83
- 'url': url,
84
- 'data': param,
85
- 'dataType': 'json',
86
- 'async': async
87
- }).fail(function(jqXHR,sts){
88
- console.error('加载数据失败:' + sts + ", " + url);
89
- }).done(function(ret){
90
- if (!ret || ret.code != 0) {
91
- console.error('加载数据失败:' + JSON.stringify(ret) + ", " + url);
92
- }
93
- if (retfn) retfn(ret);
94
- });
95
- }
96
-
97
- // 查找顶层窗口(注:相同域名下使用)
98
- // 查找调度主连接所在窗口
99
- function findMainFrame(w) {
100
- w = w||window;
101
- try{
102
- w = w||window;
103
- //
104
- while (w != w.parent) {
105
- if (w.scooper && w.scooper.dispatch
106
- && w.scooper.dispatch.getType() == "main") {
107
- return w;
108
- }
109
- w = w.parent;
110
- }
111
- return w.top;
112
- } catch(e){
113
- alert("调度主连接获取异常,请查询是否存在跨域初始的异常");
114
- return w;
115
- }
116
- }
117
-
118
- // constants
119
- var event_const = {
120
- CONN_CNG : "connectionChanged",
121
- CHANGE_CFG: "changeConfigNotify",
122
- CALL_IN : "callInChanged",
123
- CALL_STS : "telStatusChanged",
124
- CALL_RECORD: "recordStatusChanged", //废弃
125
- RECORD_NOTIFY: "recordNotify", //通话记录 & 录音/录像 记录通知
126
- RECORD_STATUS_NOTIFY: "recordStatusNotify", //通话录音状态
127
- MEET_STS : "meetStatusChanged",
128
- MEET_MEM : "meetMemberChanged",
129
- MEET_LST : "meetListChanged",
130
- MEET_RECORD_NOTIFY: "meetRecordNotify", //会议记录 & 会议录音/录像 记录通知
131
- MEET_MEM_RECORD_NOTIFY: "meetMemRecordNotify", //会场历史 成员记录通知
132
- MEET_MEM_RECORD_DEL_NOTIFY: "meetMemRecordDelNotify", //会场历史 成员记录清空
133
- DATA_INIT : "dataInitailized",
134
- METHOD_RT : "methodResponse",
135
- DATE_STATE: "dateStateChanged",
136
- PACK_RES_CHN: "packageResult",
137
- PACK_RES_DATA: "respData",
138
- POC_SWITCH_CHN:"pocGroupSwitchChanged",
139
- POC_PTT_CHN:"pocPttChanged",
140
- POC_MEM_CHN:"pocMemStatusChanged",
141
- POC_SOS_CHN:"pocMemSosChanged",
142
- POC_MEM_JOIN_GROUP_CHN:"pocMemJoinGroupChanged",
143
- POC_GROUP_CHN:"pocGroupStatusChanged",
144
- POC_GROUP_INLINE_CHN:"pocInLineChanged",
145
- POC_PHONE_STATUS_CHN:"pocPhoneStatusChanged",
146
- DATA_CHANGE:"dataChange",
147
- DISP_MEMBER_CHANGE:"dispMember"
148
- };
149
- var status_const = {
150
- OFFLINE : "callst_offline", //离线
151
- IDLE : "callst_idle", //空闲
152
- WAITRING : "callst_waitring", //预振铃
153
- CALLRING : "callst_ring", //振铃中
154
- CALLANSWER : "callst_answer", //应答
155
- CALLHOLD : "callst_hold", //保持中
156
- CALLTRANSFING : "callst_transfering", //转接中
157
- CALLTRANSFER : "callst_transfer", //转接
158
- CALLTURNING : "callst_turning", //轮询中
159
- DOUBLETALK : "callst_doubletalk", //双方通话
160
- MEET : "callst_meet", //在会场中
161
- BREAKIN : "callst_breakin", //强插
162
- MONITOR : "callst_monitor", //监听通话
163
- CALLINWAITANSWER : "callst_callinwaitanswer", //呼入未应答
164
- MONITORRING : "callst_monitorring", //双方直接通话响铃
165
- MONITORANSWER : "callst_monitoranswer", //双方直接通话
166
- MONITOROFFHOOK : "callst_monitoroffhook", //监听摘机
167
- POC : "callst_poc", //对讲
168
- POC_GROUP : "callst_poc_group", //对讲组
169
- POC_BROADCAST : "callst_poc_broadcast" //对讲广播
170
- };
171
- //scooperCore中的访问路径
172
- var scooperCoreUrl = {
173
- "dispMmber":"/data/dispatch/dispMemberManage/getDispMemberDetail",//根据快捷组成员关联id获取快捷组成员关联信息
174
- }
175
-
176
- /**
177
- * 调度相关操作
178
- *
179
- * 事件:
180
- * connectionChanged
181
- * callInChanged
182
- * telStatusChanged
183
- * meetStatusChanged
184
- * meetMemberChanged
185
- */
186
- function Dispatch() {
187
- var self = this;
188
- var dispatch = this;
189
- var initialized = false;
190
- var subscribed = false; //消息订阅注册
191
- var connected = false; // 与调度后台的连接状态
192
- var webConnected = false; // 与Web后台的连接状态
193
- var firstWebConnected = true;
194
- var token = '';
195
- var accountToken = '';
196
- var account = '';
197
- var loginExamine = '';//客户端登入后网页端登入标识位
198
- var dispatchOper = null;
199
- var scooperCoreIp="/scooper-core-rest";
200
-
201
- getLoginExamine();
202
- // Server-Send Event instance
203
- var sse = new scooper.SSE("dispatch");
204
-
205
- // use as Event Dispatcher
206
- var dom = document.createElement('div');
207
-
208
- // SSE 连接状态变化通知
209
- function onSSEConnectionCallback(sseConnected) {
210
- var tryReload = (!firstWebConnected && webConnected != sseConnected && sseConnected);
211
- webConnected = sseConnected;
212
- //
213
- if (tryReload) {
214
- pullDispatchToken();
215
- }
216
- // fire events
217
- fireListens(event_const.CONN_CNG, (sseConnected && connected));
218
- //初始化消息通知
219
- if(sseConnected && firstWebConnected) {
220
- linkCometdMsg();
221
- }
222
- if (sseConnected) firstWebConnected = false;
223
- }
224
- // 服务端过来的连接通知
225
- function onConnected(msg) {
226
- // {"data":true,"channel":"/conn"}
227
- var data = msg.data;
228
- if (!data || account != data.account) return;
229
- //
230
- connected = data.connected;
231
- // fire events
232
- fireListens(event_const.CONN_CNG, connected);
233
- }
234
- // 调度后台派发的 change_cfg 通知
235
- function onConfigChanged(msg) {
236
- // {type,value}
237
- var data = msg.data;
238
- // console.log("/server/config", data);
239
- fireListens(event_const.CHANGE_CFG, data);
240
- }
241
- //调度后台派发的data_state_change
242
- function onDataStateChange(msg) {
243
- var data = msg.data;
244
- fireListens(event_const.DATE_STATE, data);
245
- }
246
- //数据变化msgQ通知
247
- function dataChange(msg) {
248
- var data = msg.data;
249
- //console.log(data);
250
- fireListens(event_const.DATA_CHANGE, data);
251
- }
252
- //快捷组成员关联变化通知实现类
253
- function dispatchMember(msg) {
254
- var data = msg.data;
255
- if(token != null && token != "") {
256
- var url = scooperCoreIp + scooperCoreUrl.dispMmber;
257
- var jsonData = {'token':token,'id':''};
258
- if(data.changeType == "DELETE") {
259
- jsonData['isActive'] = 0;
260
- } else if(data.changeType == "ADDLIST") {
261
- data.changeType = "ADD";
262
- }
263
- var ids = data.id.split(',');
264
- $.each(ids,function(i,e){
265
- jsonData.id = e;
266
- _loadJson(url,jsonData,function(resp){//获取调度快捷组和成员数据
267
- //添加快捷组信息
268
- data['id'] = jsonData.id;
269
- data['groupType'] = resp.data.groupType;
270
- data['groupNo'] = resp.data.groupNo;
271
- data['memTel'] = resp.data.memTel;
272
- data['memLevel'] = resp.data.memLevel;
273
- data['orgMemId'] = resp.data.orgMemId;
274
- fireListens(event_const.DISP_MEMBER_CHANGE, data);
275
- });
276
- });
277
- }
278
- }
279
- this.setRemoteBaseUrl = function(val) {
280
- sse.setRemoteBaseUrl(val);
281
- };
282
-
283
- /** 连接标识,如果是Web服务端调用接口连接;需要先使用代码设置该值,再进行后续操作(呼叫等) */
284
- this.getToken = function() { return token; };
285
-
286
- this.setToken = function(val) {
287
- var needLoad = (token != val);
288
- //
289
- token = val;
290
- //
291
- if (needLoad) {
292
- // 当设置新的token时重新订阅
293
- initialized = false;
294
- self.initialize();
295
- //
296
- loadConnection();
297
- loadAllDatas();
298
- }
299
- };
300
-
301
- /** 登录账号的 token;当采用js方式内嵌到其它共用 DB_SC_CORE.T_ACCOUNT 的程序可实现后台自动登录; */
302
- this.getAccountToken = function() { return accountToken; };
303
- this.setAccountToken = function(val) {
304
- var changed = (accountToken != val);
305
- //
306
- accountToken = val;
307
- //
308
- if (changed) {
309
- pullDispatchToken();
310
- }
311
- };
312
-
313
- //数据加载
314
- this.loadData = {
315
- 'notifyRecordFile': function(){
316
- //获取组户通知文件列表
317
- $.getJSON(getBaseUrl()+'data/dispatch/recordNotify/notifyRecordQurry',"",function(ret){
318
- return ret;
319
- });
320
- }
321
- };
322
-
323
- /** 根据账号的token 获取账号信息 **/
324
- this.getAccountByToken = function(accountToken, callBack) {
325
- var param = {
326
- 'accountToken': accountToken
327
- };
328
- $.getJSON(getBaseUrl()+'view/dispatch/getAccountByAccToken',param,function(ret){
329
- callBack(ret);
330
- });
331
- }
332
- /**获取当前帐号的操作员信息*/
333
- this.getDispatchOper = function() {
334
- return dispatchOper;
335
- }
336
- //
337
- function pullDispatchToken() {
338
- var param = {
339
- 'accountToken': accountToken
340
- };
341
- $.getJSON(getBaseUrl()+'view/dispatch/getDispatchToken',param,function(ret){
342
- if (ret && ret.code == 0) {
343
- account = ret.data.account;
344
- self.setToken(ret.data.token);
345
- }
346
- });
347
- }
348
- this.setScooperIp = function(val) {
349
- if(val != "") {
350
- scooperCoreIp = "http://" + val + "/scooper-core-rest";
351
- }
352
- };
353
-
354
- /** 呼叫相关操作 */
355
- this.calls = new Call();
356
- /** 会议相关操作 */
357
- this.meets = new Meet();
358
- /** 对讲组相关操作*/
359
- this.groupPoc = new GroupPoc();
360
- /** 是否连接调度后台 */
361
- this.isConnected = function() {
362
- return !!token && connected && webConnected;
363
- };
364
- /** 初始化 */
365
- this.initialize = function() {
366
- if (initialized) return;
367
- initialized = true;
368
- //防止内外网切换访问限制
369
- // if(window.scooperCoreIp != null && window.scooperCoreIp != "") {
370
- // scooperCoreIp = "http://" + window.scooperCoreIp + "/scooper-core-rest";
371
- // }
372
- sse.setConnectionCallback(onSSEConnectionCallback);
373
- sse.initialize();
374
-
375
- /*页面心跳机制*/
376
- $.getJSON(apiUrl('/conn/getHearTime'),"", function(ret) {
377
- if(ret.code == 0 && ret.data){
378
- setInterval(heartKeep,ret.data);
379
- } else {
380
- setInterval(heartKeep,60000);
381
- }
382
- });
383
- };
384
-
385
- //初始化消息通知
386
- function linkCometdMsg(){
387
- //获取调度操作员信息
388
- getDispatchOper(function(dispatchOper) {
389
- var accId = dispatchOper? dispatchOper.acc_id:"";
390
- var corpId = dispatchOper? dispatchOper.corp_id:"";
391
- if(!subscribed) {
392
- var accTopic = accId? "/"+accId : ""; //主题通道追加账号标识
393
- var corpTopic = corpId? "/"+corpId : ""; //主题通道追加分权id标识
394
- console.log("连接成功,开启消息推送");
395
- sse.subscribe('/conn', onConnected);
396
- sse.subscribe(accTopic + '/server/config', onConfigChanged);
397
- //客户端数据节点变化 for 柯桥警情
398
- sse.subscribe('/server/dataState', onDataStateChange);
399
- //增加数据状态变化通知
400
- sse.subscribe(corpTopic + '/disptchWeb/dataChange',dataChange);
401
- //增加调度快捷组成员关联状态变化通知
402
- sse.subscribe(corpTopic + '/scooper_core/dataChange/dispMember',dispatchMember);
403
- self.calls.initialize(accId);
404
- self.meets.initialize(accId);
405
- self.groupPoc.initialize(accId, corpId);
406
- subscribed = true;
407
- }
408
- });
409
- }
410
-
411
- function getDispatchOper(fn) {
412
- if(token == null || token == "") {
413
- setTimeout(function() {
414
- getDispatchOper(fn);
415
- }, 500);
416
- return;
417
- }
418
- $.getJSON(apiUrl('/conn/getDispatchOper'),{"token":token}, function(ret) {
419
- if(ret.code == 0 && ret.data){
420
- console.log("获取操作员信息成功, func[getDispatchOper]");
421
- dispatchOper = ret.data;
422
- }
423
- else {
424
- console.error("获取操作员信息失败, func[getDispatchOper], by token:" + token);
425
- }
426
-
427
- if(fn) fn(dispatchOper);
428
- });
429
- }
430
-
431
- /** 网页端和后台创建心跳机制 */
432
- var heartKeep = function() {
433
- if(token && token != ""){
434
- var jsonData = {
435
- "token":token,
436
- "loginExamine":""
437
- }
438
- if(loginExamine && loginExamine != ""){
439
- jsonData.loginExamine = loginExamine;
440
- }
441
- $.getJSON(apiUrl('/conn/heartKeep'), jsonData, function(ret) {});
442
- }
443
- }
444
-
445
- /** 销毁 */
446
- this.destroy = function() {
447
- self.calls.destroy();
448
- self.meets.destroy();
449
- self.groupPoc.destroy();
450
- initialized = false;
451
- subscribed = false;
452
- };
453
- /** 与调度服务器建立连接
454
- * @param user 账号名
455
- * @param pass 密码,SHA256加密
456
- * */
457
- this.login = function(user,pass) {
458
- $.getJSON(apiUrl('/conn'), {'user':user,'pass':pass}, function(ret) {
459
- // {code,data{token,reuse}}
460
- account = ret.data.account;
461
- token = ret.data.token;
462
- // 如果是已经登录,则将后台数据加载过来
463
- if (ret.data.reuse) {
464
- loadAllDatas();
465
- }
466
- });
467
- };
468
- /**设置客户端登入后的网页端同步登入字符串*/
469
- this.setloginExamine = function(loginExamines){
470
- if(loginExamines && loginExamines != ""){
471
- loginExamine = loginExamines;
472
- }
473
- };
474
-
475
- function getLoginExamine() {
476
- if(loginExamine) return loginExamine;
477
-
478
- var url = window.location.href;
479
- try{
480
- if(url.indexOf("loginExamine") == -1 && window.top) {
481
- url = window.top.location.href;
482
- }
483
- var portRule = /loginExamine=\d+&?/;
484
- var loginExamineParam = url.match(portRule);
485
- if(loginExamineParam) {
486
- loginExamine = loginExamineParam[0].replace("loginExamine=", "").replace("&","");
487
- console.log("loginExamine:" + loginExamine);
488
- }
489
- return loginExamine;
490
- }
491
- catch (e) {
492
- console.log("获取loginExamine异常", e);
493
- }
494
-
495
- }
496
-
497
- /**根据token和后台建立服务*/
498
- this.loginByToken = function(loginToken, fn) {
499
- $.getJSON(apiUrl('/conn/connectionByToken'), {'token':loginToken,"loginExamine":loginExamine}, function(ret) {
500
- if(ret.code == 0) {
501
- // {code,data{token,reuse}}
502
- account = ret.data.account;
503
- token = ret.data.token;
504
- // 如果是已经登录,则将后台数据加载过来
505
- if (ret.data.reuse) {
506
- loadAllDatas();
507
- }
508
- }
509
- else {
510
- console.log(ret.message);
511
- }
512
- if(fn) fn(ret);
513
- });
514
- };
515
- // 获取登录连接状态
516
- function loadConnection() {
517
- var param = {'token': token};
518
- //
519
- $.getJSON(apiUrl("/conn/connected"),param,function(ret){
520
- // {code,data}
521
- if (ret) {
522
- connected = ret.data.connected;
523
- if (connected) {
524
- account = ret.data.account;
525
- } else {
526
- account = '';
527
- }
528
- //
529
- fireListens(event_const.CONN_CNG, connected);
530
- }
531
- });
532
- }
533
- // 如果是已经登录,加载所有数据
534
- function loadAllDatas() {
535
- // 检查数据是否都加载完成,加载完成则派发事件
536
- var chk_complete = (function(){
537
- var _count = 0;
538
- var _max = 0;// 总共需加载的次数
539
- return function() {
540
- _max++;
541
- return function(o){
542
- _count++;
543
- if (_count >= _max) {
544
- fireListens(event_const.DATA_INIT, true);
545
- }
546
- };
547
- };
548
- })();
549
- //
550
- self.calls.listStatus(chk_complete());
551
- self.calls.listCallIn(chk_complete());
552
- self.meets.listMeets(chk_complete());
553
- self.groupPoc.listGroupStatus(chk_complete());
554
- self.groupPoc.listMemStatus(chk_complete());
555
- // self.groupPoc.listMemSos(chk_complete());
556
- // self.groupPoc.listJoinGroupReq(chk_complete());
557
- }
558
- /** 断开与调度服务器的连接 */
559
- this.logout = function() {
560
- if (!token) return;
561
- $.getJSON(apiUrl('/conn/logout'), {'token':token}, function() {
562
- token = '';
563
- });
564
- };
565
- /**
566
- * 向后台发送 change_cfg 消息
567
- */
568
- this.sendChangeCfg = function(type,value,fn) {
569
- checkLogin();
570
- var param = {
571
- 'token': token,
572
- 'type' : type ,
573
- 'value': value
574
- };
575
- $.getJSON(apiUrl('/conn/changeCfg'), param, function(data){
576
- fireMethodResponse(data);
577
- if(fn)
578
- fn(data);
579
- });
580
- };
581
- //
582
- this.listen = function(evtType,fn) {
583
- $(dom).on(evtType, fn);
584
- };
585
- this.unlisten = function(evtType,fn) {
586
- $(dom).unbind(evtType, fn);
587
- };
588
- //
589
- function fireListens(evtType, data) {
590
- var e = $.Event(evtType, {'msg':data});
591
- if(data && data.timeStamp) {
592
- e.timeStamp = data.timeStamp;
593
- }
594
- $(dom).trigger(e);
595
- }
596
- //
597
- function fireMethodResponse(data) {
598
- fireListens(event_const.METHOD_RT, data);
599
- }
600
- //
601
- // 验证是否登录,或者 token 是否被设置
602
- function checkLogin() {
603
- if (!token) throw new Error('token is empty! (you need login or set token first)');
604
- }
605
- // 呼叫相关操作
606
- function Call() {
607
- var self = this;
608
- // 当前的号码状态集合 tel:{tel,status,recording}
609
- var telStatus = {};
610
- this.requestCallStatus = function(fn) {
611
- if(fn) { fn(telStatus); }
612
- };
613
- this.requestTelStatus = function(tel,fn) {
614
- if(fn) { fn(telStatus[tel]); }
615
- };
616
- // 当前的呼入号码集合 {tel,time}
617
- var callIns = [];
618
- this.requestCallIns = function(fn) { if(fn) fn(callIns); }
619
- //
620
- function callUrl(path) { return apiUrl('/call' + path); }
621
- //
622
- function onCallStatusNotify(msg) {
623
- // {"data":{"status":"callst_idle","recording":false,"tel":"5010"},"channel":"/call/status"}
624
- var data = msg.data;
625
- //
626
- var sts = updateTelStatus(data);
627
- var stsCopy = $.extend(true, {}, sts);
628
- // fire events
629
- if(data.notifyType) {
630
- fireListens(event_const.CALL_RECORD, stsCopy);
631
- }
632
- else {
633
- fireListens(event_const.CALL_STS, stsCopy);
634
- }
635
- }
636
-
637
- function onCallRecordStatusNotify(msg) {
638
- var data = msg.data;
639
- //
640
- var sts = updateTelStatus(data);
641
- var stsCopy = $.extend(true, {}, sts);
642
- // fire events
643
- if(data.notifyType) {
644
- fireListens(event_const.CALL_RECORD, stsCopy);
645
- }
646
- }
647
- //通话记录 & 通话录音/录像 通知
648
- function onRecordNotify(msg) {
649
- //{businessId, notifyType:呼叫类型, callId:呼叫id, recId:数据记录id, recordStatus:录音状态, callerNumber:主叫号码, calledNumber}
650
- //record_call_notify: 录音; record_call_av_notify: 录像通知; call_record_notify:通话记录
651
- var data = msg.data;
652
- // console.log("recordCall", data);
653
- if(data.notifyType) {
654
- fireListens(event_const.RECORD_NOTIFY, data);
655
- }
656
- }
657
- function onRecordStatusNotify(msg) {
658
- //{tel:通知号码, conNumber通话号码, recordStatus}
659
- var data = msg.data;
660
- var tel = data.tel;
661
- if(tel) {
662
- var sts = telStatus[data.tel];
663
- if(sts) {
664
- sts.recording = data.recordStatus == "ON";
665
- }
666
- }
667
- // console.log("recordStatus", data);
668
- fireListens(event_const.RECORD_STATUS_NOTIFY, data);
669
- }
670
- //
671
- function updateTelStatus(data) {
672
- var sts = telStatus[data.tel];
673
- if (sts) {
674
- sts.tel = data.tel;
675
- sts.notifyType = data.notifyType;
676
-
677
- sts.handleNumber = data.handleNumber;
678
- sts.conNumber = data.conNumber;
679
-
680
- // sts.suffixNum = data.suffixNum;
681
- // sts.suffixNumHn = data.suffixNumHn;
682
- sts.timeStamp = data.timeStamp;
683
- sts.time = data.time;
684
- if(!data.notifyType) {
685
- sts.status = data.status;
686
- //sts.handleNumber = data.handleNumber;
687
- sts.meetId = data.meetId;
688
- sts.videoInfo = data.videoInfo;
689
- sts.recording = data.recording;
690
- }
691
- else {
692
- sts.businessId = data.businessId;
693
- sts.callId = data.callId;
694
- sts.dataRecid = data.dataRecid;
695
- if("record_call_notify" == data.notifyType) {
696
- sts.recording = data.recording;
697
- }
698
- }
699
- } else {
700
- telStatus[data.tel] = sts = {
701
- 'tel': data.tel,
702
- 'status': data.status,
703
- 'recording': data.recording,
704
- 'handleNumber': data.handleNumber,
705
- 'meetId': data.meetId,
706
- 'videoInfo': data.videoInfo,
707
- // 'suffixNum': data.suffixNum,
708
- // 'suffixNumHn': data.suffixNumHn,
709
- 'timeStamp': data.timeStamp,
710
-
711
- 'businessId': data.businessId,
712
- 'callId': data.callId,
713
- 'conNumber': data.conNumber,
714
- 'dataRecid': data.dataRecid
715
- };
716
- }
717
- return sts;
718
- }
719
- //
720
- function onCallInNotify(msg) {
721
- // {"data":{"tel":"5010","add":true,"time":14001010111},"channel":"/call/in","usrLevel":2}
722
- var data = msg.data;
723
- //
724
- var type;
725
- var c = null;
726
- if (data.add) {
727
- c = addCallIn(data);
728
- type = 'add'
729
- } else {
730
- c = removeCallInByTel(data.tel);
731
- type = 'del';
732
- }
733
-
734
- // fire events
735
- if (c != null) {
736
- var cCopy = $.extend(true, {}, c);
737
- fireListens(event_const.CALL_IN, {'type':type,'data':cCopy,'usrLevel':data.usrLevel});
738
- }
739
- }
740
- // 按号码在呼入队列中查找
741
- function findCallInByTel(tel) {
742
- for (var i = 0; i < callIns.length; i++) {
743
- var c = callIns[i];
744
- if (c && c.tel == tel) {
745
- return c;
746
- }
747
- }
748
- return null;
749
- }
750
- // 添加到呼入队列中
751
- function addCallIn(data) {
752
- var c = findCallInByTel(data.tel);
753
- if (c != null) {
754
- c.time = data.time;
755
- c.usrLevel = data.usrLevel;
756
- c.suffixNum = data.suffixNum;
757
- return c;
758
- }
759
- c = {
760
- 'tel': data.tel,
761
- 'time': data.time,
762
- 'usrLevel':data.usrLevel,
763
- 'suffixNum':data.suffixNum
764
- };
765
- callIns.push(c);
766
- return c;
767
- }
768
- // 从呼入队列中移除
769
- function removeCallInByTel(tel) {
770
- var c = null;
771
- for (var i = callIns.length - 1; i >= 0; i--) {
772
- if (callIns[i] && callIns[i].tel == tel) {
773
- c = callIns[i];
774
- callIns.splice(i, 1);
775
- }
776
- }
777
- return c;
778
- }
779
-
780
- //组呼结果
781
- function onPackageResult(msg) {
782
- //{packageresult: "success", packageReason: "group_notify", packageType: "成功数/总数:[1/1],成功[3001],失败[]"}
783
- var data = msg.data;
784
- //
785
- var type;
786
- type = data.packageresult;
787
-
788
- fireListens(event_const.PACK_RES_CHN, {'type':type,'data':data.packageReason});
789
- }
790
-
791
- function onRespData(msg) {
792
- var data = msg.data;
793
- /*{id: 10000, type: 'make_call', result:'success||fail', reason: '', 其他具体根据调度协议来识别}*/
794
- var type = data.type;
795
- fireListens(event_const.PACK_RES_DATA, {'type':type,'data':data});
796
- }
797
- //
798
- this.initialize = function(accId) {
799
- var accTopic = accId? "/"+accId : ""; //主题通道追加账号标识
800
- sse.subscribe(accTopic + '/call/status', onCallStatusNotify);
801
- sse.subscribe(accTopic + '/call/record/status', onCallRecordStatusNotify);
802
- sse.subscribe(accTopic + '/call/record', onRecordNotify);
803
- sse.subscribe(accTopic + '/call/recordStatus', onRecordStatusNotify);
804
- sse.subscribe(accTopic + '/call/in', onCallInNotify);
805
- sse.subscribe(accTopic + '/packageResult', onPackageResult);
806
- sse.subscribe(accTopic + '/respData', onRespData);
807
- }
808
- this.destroy = function() {
809
- //sse.unsubscribe('/call/status');
810
- }
811
- //
812
- this.listStatus = function(resultCallback) {
813
- checkLogin();
814
- $.getJSON(callUrl('/listStatus'), {'token':token,'loginExamine':loginExamine}, function(data) {
815
- // {code,total,list:[{tel,status,recording}]}
816
- if (data && data.list && data.list.length) {
817
- for (var i = 0; i < data.list.length; i++) {
818
- updateTelStatus(data.list[i]);
819
- }
820
- }
821
- //
822
- if (resultCallback) resultCallback(data);
823
- });
824
- };
825
- this.listCallIn = function(resultCallback) {
826
- checkLogin();
827
- $.getJSON(callUrl('/listCallIn'), {'token':token}, function(data) {
828
- // {code,total,list:[{tel,time}]}
829
- data = data.data;
830
- if (data && data.list && data.list.length) {
831
- for (var i = 0; i < data.list.length; i++) {
832
- addCallIn(data.list[i]);
833
- }
834
- }
835
- //
836
- if (resultCallback) resultCallback(data);
837
- });
838
- };
839
- //
840
- function requestNoParam(path) {
841
- checkLogin();
842
- $.getJSON(callUrl(path), {'token':token}, function(data){
843
- fireMethodResponse(data);
844
- });
845
- }
846
- function requestWithTel(path, tel, businessId) {
847
- checkLogin();
848
- $.getJSON(callUrl(path), {'token':token,'tel':tel, 'businessId': businessId}, function(data){
849
- fireMethodResponse(data);
850
- });
851
- }
852
- function requestWithGroupId(path,groupId,autoAnswer,allAudience) {
853
- checkLogin();
854
- $.getJSON(callUrl(path), {'token':token,'groupId':groupId,'autoAnswer':autoAnswer,'allAudience':allAudience}, function(data){
855
- fireMethodResponse(data);
856
- });
857
- }
858
- //
859
- this.makeCall = function(tel, businessId) {
860
- requestWithTel('/makeCall',tel, businessId);
861
- };
862
- this.makeVideoCall = function(tel, businessId) {
863
- requestWithTel('/makeVideoCall',tel, businessId);
864
- };
865
- this.hungUp = function(tel) {
866
- requestWithTel('/hungup',tel);
867
- };
868
- this.answer = function(tel,businessId) {
869
- requestWithTel('/answer',tel, businessId);
870
- };
871
- this.answerAll = function() {
872
- requestNoParam('/answerAll');
873
- };
874
- this.rollCall = function(tels) {
875
- if (!tels || tels.length == 0) throw new Error("tels can't be empty!");
876
- checkLogin();
877
- $.getJSON(callUrl('/rollCall'),{'token':token,'tels':tels.join(",")}, function(data){
878
- fireMethodResponse(data);
879
- });
880
- };
881
- this.stopRollCall = function() {
882
- checkLogin();
883
- $.getJSON(callUrl('/stopRollCall'),{'token':token}, function(data){
884
- fireMethodResponse(data);
885
- });
886
- };
887
- this.groupTurn = function(tels, isOnce) {
888
- //isOnce
889
- if (!tels || tels.length == 0) throw new Error("tels can't be empty!");
890
- checkLogin();
891
- $.getJSON(callUrl('/groupTurn'),{'token':token,'tels':tels.join(","), 'isOnce':isOnce}, function(data){
892
- fireMethodResponse(data);
893
- });
894
- };
895
- this.hold = function(tel) {
896
- requestWithTel('/hold',tel);
897
- };
898
- this.unhold = function(tel) {
899
- requestWithTel('/unhold',tel);
900
- };
901
- this.transfer = function(from, to, businessId) {
902
- checkLogin();
903
- $.getJSON(callUrl('/transfer'),{'token':token,'from':from,'to':to, 'businessId': businessId}, function(data){
904
- fireMethodResponse(data);
905
- });
906
- };
907
- this.retrieve = function(tel) {
908
- requestWithTel('/retrieve',tel);
909
- };
910
- this.tripleMonitor = function(tel) {
911
- requestWithTel('/tripleMonitor',tel);
912
- };
913
- this.tripleBreakin = function(tel) {
914
- requestWithTel('/tripleBreakin',tel);
915
- };
916
- this.tripleHungup = function(tel) {
917
- requestWithTel('/tripleHungup',tel);
918
- };
919
- this.callRecord = function(tel) {
920
- requestWithTel('/callRecord',tel);
921
- };
922
- this.callRecordEnd = function(tel) {
923
- requestWithTel('/callRecordEnd',tel);
924
- };
925
- this.groupCall = function(groupId,autoAnswer,allAudience) {
926
- requestWithGroupId('/groupCall',groupId,autoAnswer,allAudience);
927
- };
928
- this.groupCancel = function(groupId) {
929
- requestWithGroupId('/groupCancel',groupId);
930
- };
931
- this.selectCall = function(tels,autoAnswer,allAudience) {
932
- if (!tels || tels.length == 0) throw new Error("tels can't be empty!");
933
- checkLogin();
934
- $.getJSON(callUrl('/selectCall'),{'token':token,'tels':tels.join(),'autoAnswer':autoAnswer,'allAudience':allAudience}, function(data){
935
- fireMethodResponse(data);
936
- });
937
- };
938
- this.selectCancel = function() {
939
- requestNoParam('/selectCancel');
940
- };
941
- this.groupSame = function(memIds,autoAnswer,allAudience) {
942
- if (!memIds || memIds.length == 0) throw new Error("memIds can't be empty!");
943
- checkLogin();
944
- $.getJSON(callUrl('/groupSame'),{'token':token,'memberIds':memIds.join(),'autoAnswer':autoAnswer,'allAudience':allAudience}, function(data){
945
- fireMethodResponse(data);
946
- });
947
- };
948
- //
949
- function requestGroupNotify(param,type,times,notifyId, confirm) {
950
- checkLogin();
951
- //
952
- param['token'] = token;
953
- if (type) param["type"] = type;
954
- if (times && !isNaN(times)) param["times"] = times;
955
- if (notifyId) param["notifyId"] = notifyId;
956
- if (confirm) param["confirm"] = confirm;
957
- //
958
- $.ajax({
959
- type: 'post',
960
- traditional: true,
961
- url: callUrl('/groupNotify'),
962
- data: param,
963
- success: function(ret){
964
- fireMethodResponse(ret);
965
- }
966
- });
967
- }
968
- /**
969
- * @param type notify : 通知音录音,call_record : 通话录音,text : TTS(playfile携带文字)。
970
- */
971
- this.groupNotify = function(groupId,files,type,times,notifyId) {
972
- if (!groupId) throw new Error("groupId can't be empty!");
973
- if (!files) throw new Error("files can't be empty!");
974
- //
975
- var param = {
976
- "groupId": groupId,
977
- "files": files.join()
978
- };
979
- //
980
- requestGroupNotify(param, type, times, notifyId);
981
- };
982
- /**
983
- * @param type notify : 通知音录音,call_record : 通话录音,text : TTS(playfile携带文字)。
984
- */
985
- this.selectNotify = function(tels,files,type,times,notifyId,confirm) {
986
- // if (!tels) throw new Error("tels can't be empty!");
987
- if (!tels) throw new Error("呼叫的成员不能为空!");
988
- if (!files) throw new Error("files can't be empty!");
989
- //
990
- var param = {
991
- "tels": tels,
992
- "files": files
993
- };
994
- if(type == "text") param["files"] = files;
995
- //
996
- requestGroupNotify(param, type, times, notifyId, confirm);
997
- };
998
- // 同振
999
- this.makeCallSame = function(tels, meetId) {
1000
- if (!tels) throw new Error("号码不能为空!");
1001
- // if (!tels) throw new Error("tels can't be empty!");
1002
- //
1003
- var param = {
1004
- "token": token,
1005
- "tels": tels.join()
1006
- };
1007
- if(meetId) param.meetId = meetId;
1008
- //
1009
- checkLogin();
1010
- $.getJSON(callUrl('/makeCallSame'), param, function(data){
1011
- fireMethodResponse(data);
1012
- });
1013
- };
1014
- this.openVideo = function(callNumber,callId,businessId,avRecord) {
1015
- checkLogin();
1016
- var param = {
1017
- "token": token,
1018
- "callNumber": callNumber,
1019
- "callId": callId,
1020
- "businessId":businessId,
1021
- "avRecord":avRecord
1022
- };
1023
- $.getJSON(callUrl('/openVideo'), param, function(data){
1024
- fireMethodResponse(data);
1025
- });
1026
- };
1027
- this.closeVideo = function(callNumber) {
1028
- checkLogin();
1029
- var param = {
1030
- "token": token,
1031
- "callNumber": callNumber
1032
- };
1033
- $.getJSON(callUrl('/clodeVideo'), param, function(data){
1034
- fireMethodResponse(data);
1035
- });
1036
- };
1037
- /**
1038
- * 通知音操作
1039
- * @param tel
1040
- * @param title
1041
- * @param opType record:录制; play:播放通知音; del:删除通知音;
1042
- * re_record:重新录制,对某个通知音进行重录
1043
- * finish:结束录制,只有录制和重新录制后调用结束录制才有效。
1044
- * @param filename 通知音文件名,当opType为play、del和re_record时, 必须携带该值。
1045
- */
1046
- this.notifyRecordOP = function(tel, title, opType, filename) {
1047
- checkLogin();
1048
- var param = {
1049
- "token": token,
1050
- "tel": tel,
1051
- "title": title,
1052
- "opType": opType,
1053
- "filename": filename
1054
- }
1055
- $.getJSON(callUrl('/notifyRecordOP'), param, function(data){
1056
- fireMethodResponse(data);
1057
- });
1058
- }
1059
- }
1060
- // 会议相关操作
1061
- function Meet() {
1062
- var self = this;
1063
- // 当前存在的会场集合 {id,name,locked,playvoice,recording,members}
1064
- // members:[{meetId,tel,level}]
1065
- var meets = [];
1066
- // function(meets)
1067
- this.requestMeets = function(fn) { if(fn) fn(meets); }
1068
- this.requestMeet = function(id, fn) {
1069
- var meet = findMeetById(id);
1070
- if (fn) fn(meet?meet:null);
1071
- }
1072
- // function(members)
1073
- this.requestMeetMembers = function(id,fn) {
1074
- var meet = findMeetById(id);
1075
- if (fn) fn(meet?meet.members:null);
1076
- };
1077
- // function(member)
1078
- this.requestMeetMember = function(meetId,tel,fn) {
1079
- if (fn) {
1080
- fn(findMeetMember(meetId, tel));
1081
- }
1082
- };
1083
- //
1084
- function findMeetMember(meetId,tel) {
1085
- var meet = findMeetById(meetId);
1086
- if (!meet) return null;
1087
- for (var i = 0; i < meet.members.length; i++) {
1088
- var mem = meet.members[i];
1089
- if (mem && mem.tel == tel) {
1090
- return mem;
1091
- }
1092
- }
1093
- return null;
1094
- }
1095
- //
1096
- function meetUrl(path) { return apiUrl('/meet' + path); }
1097
- //
1098
- function onMeetStatusNotify(msg) {
1099
- // {"data":{"playvoice":false,"meetId":"1008","destroy":false,"recording":false,"meetName":"默认","locked":false},"channel":"/meet/status"}
1100
- var data = msg.data;
1101
- if (!data || !data.meetId) return;
1102
- //
1103
- var meet = findMeetById(data.meetId);
1104
- if (meet == null) {
1105
- // add
1106
- meet = addMeetByData(data);
1107
- } else {
1108
- //会场是否重新激活,如其他操作员登录,登出,再登录,
1109
- //本操作员在三种状态切换时都会一直存在这个登出操作员的会场,但是再登录时需要理解为会场新增,触发会场列表变动通知
1110
- var meetReBuild = false;
1111
- // update
1112
- if (data.meetCreateId != null) meet.createId = data.meetCreateId;
1113
- if (data.meetName != null) meet.name = data.meetName || data.meetId;
1114
- if (data.hasOwnProperty('locked')) meet.locked = data.locked;
1115
- if (data.hasOwnProperty('playvoice')) meet.playvoice = data.playvoice;
1116
- if (data.hasOwnProperty('recording')) meet.recording = data.recording;
1117
- // meet destory.update by yeb
1118
- if (data.hasOwnProperty('destroy')) {
1119
- // if(meet.destroy != data.destroy && data.destroy) {
1120
- // meetReBuild = true;
1121
- // }
1122
- if(data.meetCreateId == data.meetId && !data.destroy) {
1123
- meetReBuild = true;
1124
- }
1125
- meet.destroy = data.destroy;
1126
- }
1127
- if (data.hasOwnProperty('meetAccess')) meet.meetAccess = data.meetAccess;
1128
- if (data.hasOwnProperty('timeBegin') && data.timeBegin) meet.timeBegin = data.timeBegin;
1129
- if (data.hasOwnProperty('timeEnd')) meet.timeEnd = data.timeEnd;
1130
- if (data.hasOwnProperty('passwdSpeaker')) meet.passwdSpeaker = data.passwdSpeaker;
1131
- if (data.hasOwnProperty('passwdAudience')) meet.passwdAudience = data.passwdAudience;
1132
- if (data.hasOwnProperty('meetType')) {
1133
- meet.meetType = data.meetType;
1134
- if(meet.meetType === "MEET_RESERVE") {
1135
- if (data.hasOwnProperty('members')) {
1136
- meet.members = data.members||[];
1137
- }
1138
- }
1139
- }
1140
- meet.chairman = data.chairman?data.chairman:'';
1141
- meetReBuild && fireListens(event_const.MEET_LST, {'type':'add','meet': meet});
1142
- }
1143
- // fire events
1144
- var meetCopy = $.extend(true, {}, meet);
1145
- fireListens(event_const.MEET_STS, meetCopy);
1146
- }
1147
- function onMeetJoinNotify(msg) {
1148
- // {"data":{"meetId":"1008","tel":"5012","level":"speak"},"channel":"/meet/status"}
1149
- var data = msg.data;
1150
- //
1151
- var meet = findMeetById(data.meetId) || addMeetByData(data);
1152
- //
1153
- for (var i = 0; i < meet.members.length; i++) {
1154
- var mem = meet.members[i];
1155
- if (mem && mem.tel == data.tel) return;
1156
- }
1157
- meet.members.push({
1158
- 'meetId': data.meetId,
1159
- 'tel': data.tel,
1160
- 'level': data.level // speak|audience|chairman
1161
- });
1162
- // fire events
1163
- fireListens(event_const.MEET_MEM, {'type':'join','meetId':data.meetId,'tel':data.tel,'level': data.level});
1164
- }
1165
- function onMeetLeaveNotify(msg) {
1166
- // {"data":{"meetId":"1008","tel":"5012"},"channel":"/meet/status"}
1167
- var data = msg.data;
1168
- if (!data || !data.meetId) return;
1169
- //
1170
- var meet = findMeetById(data.meetId);
1171
- if (!meet) return;
1172
- //
1173
- for (var i = meet.members.length - 1; i >= 0; i--) {
1174
- var mem = meet.members[i];
1175
- if (mem && mem.tel == data.tel) {
1176
- meet.members.splice(i,1);
1177
- }
1178
- }
1179
- // fire events
1180
- fireListens(event_const.MEET_MEM, {'type':'leave','meetId':data.meetId,'tel':data.tel});
1181
- }
1182
- function onMeetMemStsNotify(msg) {
1183
- // {"data":{"meetId":"1008","tel":"5012","level":"speak"},"channel":"/meet/status"}
1184
- var data = msg.data;
1185
- if (!data || !data.meetId) return;
1186
- //
1187
- var meet = findMeetById(data.meetId);
1188
- if (!meet) return;
1189
- //
1190
- for (var i = meet.members.length - 1; i >= 0; i--) {
1191
- var mem = meet.members[i];
1192
- if (mem && mem.tel == data.tel) {
1193
- mem.level = data.level;
1194
- }
1195
- }
1196
- // fire events
1197
- fireListens(event_const.MEET_MEM, {'type':'level','meetId':data.meetId,'tel':data.tel,'level': data.level});
1198
- }
1199
- //会场记录 会议录音/录像记录 通知
1200
- function onMeetRecordNotify(msg) {
1201
- //{businessId, notifyType: 通知类型, recId:记录id, meetId:会议id, recordStatus:ON|OFF 会议录音状态,只用于录音通知}
1202
- //record_ call_notify: 录音; record_call_av_notify: 录像通知; meet_record_notify:会议记录
1203
- var data = msg.data;
1204
- // console.log("meetRecordCall", data);
1205
- if(data.notifyType) {
1206
- fireListens(event_const.MEET_RECORD_NOTIFY, data);
1207
- }
1208
- }
1209
- //会场历史 成员记录 通知
1210
- function onMeetMemRecordNotify(msg) {
1211
- var data = msg.data;
1212
- fireListens(event_const.MEET_MEM_RECORD_NOTIFY, data);
1213
- }
1214
- //会场历史 成员记录清空 通知(会场结束 或 人员清退超过1分钟)
1215
- function onMeetMemRecordDelNotify(msg) {
1216
- var data = msg.data;
1217
- fireListens(event_const.MEET_MEM_RECORD_DEL_NOTIFY, data);
1218
- }
1219
- //
1220
- function findMeetById(id) {
1221
- for (var i = 0; i < meets.length; i++) {
1222
- var meet = meets[i];
1223
- if (meet && meet.id == id) {
1224
- return meet;
1225
- }
1226
- }
1227
- return null;
1228
- }
1229
- //
1230
- function findMeetAndUpdate(meet) {
1231
- if (!meet) return null;
1232
- for (var i = 0; i < meets.length; i++) {
1233
- var o = meets[i];
1234
- if (o && o.id == meet.id) {
1235
- return updateMeetObject(o,meet);
1236
- }
1237
- }
1238
- return null;
1239
- }
1240
- // (oldValue,newValue)
1241
- function updateMeetObject(o,n) {
1242
- o.createId = n.createId || o.createId;
1243
- o.name = n.name || o.name;
1244
- o.type = n.type || o.type;
1245
- o.locked = n.locked || o.locked;
1246
- o.playvoice = n.playvoice || o.playvoice;
1247
- o.recording = n.recording || o.recording;
1248
- o.chairman = n.chairman || o.chairman;
1249
- o.members = n.members.length?n.members:o.members;
1250
- o.timeBegin = n.timeBegin || o.timeBegin;
1251
-
1252
- o.timeEnd = n.timeEnd || o.timeEnd;
1253
- o.meetType = n.meetType || o.meetType;
1254
- o.meetAccess = n.meetAccess || o.meetAccess;
1255
- o.passwdSpeaker = n.passwdSpeaker || o.passwdSpeaker;
1256
- o.passwdAudience = n.passwdAudience || o.passwdAudience;
1257
-
1258
- return o;
1259
- }
1260
- //转化后台获取会议信息城前端会议缓存对象
1261
- function transMeetData(data) {
1262
- if(!data) return null;
1263
-
1264
- var meet = {
1265
- 'createId': data.meetCreateId,
1266
- 'id': data.meetId,
1267
- 'meetName': data.meetName||data.meetId,
1268
- 'name': data.meetName||data.meetId,
1269
- 'type': data.meetType,
1270
- 'locked': data.locked,
1271
- 'playvoice': data.playvoice,
1272
- 'recording': data.recording,
1273
- 'chairman': data.chairman,
1274
- 'members': [], // {meetId,tel,level}
1275
- 'timeBegin': data.timeBegin||"",
1276
- 'timeEnd': data.timeEnd||"",
1277
- 'meetType': data.meetType||"",
1278
- 'meetAttr': data.meetAttr||"",
1279
- 'meetAccess': data.meetAccess||"",
1280
- 'passwdSpeaker': data.passwdSpeaker||"",
1281
- 'passwdAudience': data.passwdAudience||""
1282
- };
1283
- meet.meetType = meet.meetType||(meet.meetAttr||"");
1284
- //
1285
- if (data.members) {
1286
- for (var i = 0; i < data.members.length; i++) {
1287
- var mem = data.members[i];
1288
- meet.members.push({
1289
- 'meetId': mem.meetId,
1290
- 'tel': mem.tel,
1291
- 'level': mem.level
1292
- });
1293
- }
1294
- }
1295
- return meet;
1296
- }
1297
- function addMeetByData(data) {
1298
- var meet = transMeetData(data);
1299
- // add or update
1300
- var o = findMeetAndUpdate(meet);
1301
- if (o) {
1302
- meet = o;
1303
- } else {
1304
- meets.push(meet);
1305
- // fire events
1306
- fireListens(event_const.MEET_LST, {'type':'add','meet': meet});
1307
- }
1308
- return meet;
1309
- }
1310
- //
1311
- function removeMeetById(id) {
1312
- for (var i = meets.length - 1; i >= 0; i--) {
1313
- var meet = meets[i];
1314
- if (meet && meet.id == id) {
1315
- meets.splice(i, 1);
1316
- // fire events
1317
- fireListens(event_const.MEET_LST, {'type':'remove','meet': meet});
1318
- }
1319
- }
1320
- }
1321
- //
1322
- this.initialize = function(accId) {
1323
- var accTopic = accId? "/"+accId : ""; //主题通道追加账号标识
1324
- sse.subscribe(accTopic + '/meet/status', onMeetStatusNotify);
1325
- sse.subscribe(accTopic + '/meet/join', onMeetJoinNotify);
1326
- sse.subscribe(accTopic + '/meet/leave', onMeetLeaveNotify);
1327
- sse.subscribe(accTopic + '/meet/memsts', onMeetMemStsNotify);
1328
- sse.subscribe(accTopic + '/meet/record', onMeetRecordNotify);
1329
- sse.subscribe(accTopic + '/meet/memRecord', onMeetMemRecordNotify);
1330
- sse.subscribe(accTopic + '/meet/memRecordDel', onMeetMemRecordDelNotify);
1331
- }
1332
- this.destroy = function() {
1333
- }
1334
- //
1335
- this.listMeets = function(resultCallback) {
1336
- checkLogin();
1337
- $.getJSON(meetUrl('/listMeets'), {'token':token}, function(data) {
1338
- data = data.data;
1339
- // {code,total,list:[{meetId,meetName,recording,playvoice,locked,members:[{meetId,tel}]}]}
1340
- if(!data || !data.list || !data.list.length || data.list.length == 0) {
1341
- setTimeout(function(){
1342
- $.getJSON(meetUrl('/listMeets'), {'token':token}, function(data) {
1343
- if (data && data.list && data.list.length) {
1344
- for (var i = 0; i < data.list.length; i++) {
1345
- addMeetByData(data.list[i]);
1346
- }
1347
- }
1348
- });
1349
- },1000);
1350
- } else {
1351
- if (data && data.list && data.list.length) {
1352
- for (var i = 0; i < data.list.length; i++) {
1353
- addMeetByData(data.list[i]);
1354
- }
1355
- }
1356
- }
1357
- //
1358
- if (resultCallback) resultCallback(data);
1359
- });
1360
- };
1361
- //获取单个会场
1362
- this.getMeet = function(id, resultCallback) {
1363
- checkLogin();
1364
- $.getJSON(meetUrl('/getMeet'), {'token':token, 'meetId': id}, function(data) {
1365
- if(data.code == 0) {
1366
- var meet = transMeetData(data.data);
1367
- if(resultCallback) {
1368
- resultCallback(meet);
1369
- }
1370
- }
1371
- });
1372
- };
1373
- this.createMeet = function(name, businessId, resultCallback) {
1374
- checkLogin();
1375
- $.getJSON(meetUrl('/createMeet'), {'token':token,'name':name,'businessId': businessId}, function(data) {
1376
- // {code,packetId}
1377
- if (resultCallback) resultCallback(data);
1378
- fireMethodResponse(data);
1379
- })
1380
- };
1381
- this.createMeetDetail = function(name, businessId, resultCallback, meetAccess, meetAttr, timeBegin,
1382
- timeEnd, passwdSpeaker, passwdAudience, meetMembers, defineAttr) {
1383
- checkLogin();
1384
- var param = {
1385
- 'token': token,
1386
- 'businessId': businessId,
1387
- 'name': name,
1388
- 'meetAccess': meetAccess,
1389
- 'meetAttr': meetAttr||'MEET_INSTANT',
1390
- 'timeBegin': timeBegin,
1391
- 'timeEnd': timeEnd,
1392
- 'passwdSpeaker': passwdSpeaker,
1393
- 'passwdAudience': passwdAudience,
1394
- 'meetMembers': meetMembers,
1395
- 'defineAttr': defineAttr
1396
- }
1397
- $.getJSON(meetUrl('/createMeet'), param, function(data) {
1398
- if (resultCallback) resultCallback(data);
1399
- fireMethodResponse(data);
1400
- })
1401
- }
1402
- this.editMeet = function(meetId, meetName, resultCallback, meetAccess, meetAttr, timeBegin,
1403
- timeEnd, passwdSpeaker, passwdAudience, meetMembers) {
1404
- checkLogin();
1405
- var param = {
1406
- 'token': token,
1407
- 'meetId': meetId,
1408
- 'meetName': meetName,
1409
- 'meetAccess': meetAccess,
1410
- 'meetAttr': meetAttr||'MEET_RESERVE',
1411
- 'timeBegin': timeBegin,
1412
- 'timeEnd': timeEnd,
1413
- 'passwdSpeaker': passwdSpeaker,
1414
- 'passwdAudience': passwdAudience,
1415
- 'meetMembers': meetMembers
1416
- }
1417
- $.getJSON(meetUrl('/editMeet'), param, function(data) {
1418
- if (resultCallback) resultCallback(data);
1419
- fireMethodResponse(data);
1420
- })
1421
- }
1422
- //
1423
- function requestWithMeetId(path,id) {
1424
- checkLogin();
1425
- $.getJSON(meetUrl(path), {'token':token,'id':id}, function(data){
1426
- fireMethodResponse(data);
1427
- });
1428
- }
1429
- //
1430
- this.endMeet = function(id) {
1431
- requestWithMeetId('/endMeet', id);
1432
- }
1433
- this.destroyMeet = function(id) {
1434
- requestWithMeetId('/destroyMeet', id);
1435
- }
1436
- this.lock = function(id) {
1437
- requestWithMeetId('/lock', id);
1438
- }
1439
- this.unlock = function(id) {
1440
- requestWithMeetId('/unlock', id);
1441
- }
1442
- this.startRecord = function(id) {
1443
- requestWithMeetId('/startRecord', id);
1444
- }
1445
- this.stopRecord = function(id) {
1446
- requestWithMeetId('/stopRecord', id);
1447
- }
1448
- this.startPlayVoice = function(id) {
1449
- requestWithMeetId('/startPlayVoice', id);
1450
- }
1451
- this.stopPlayVoice = function(id) {
1452
- requestWithMeetId('/stopPlayVoice', id);
1453
- }
1454
- // meet-member actions
1455
- //
1456
- function requestAsMeetMember(path,id,tel,level,businessId,autoAnswer) {
1457
- checkLogin();
1458
- if (!level) level = '';
1459
- $.getJSON(meetUrl(path), {'token':token,'id':id,'tel':tel,'level':level, 'businessId': businessId, 'autoAnswer': autoAnswer}, function(data){
1460
- fireMethodResponse(data);
1461
- });
1462
- }
1463
- this.getMeetRecord = function(id, tel, fn) {
1464
- var param = {
1465
- 'token': token,
1466
- 'meetId': id,
1467
- 'tel': tel
1468
- };
1469
- $.getJSON(meetUrl('/getMeetRecord'), param, function(data) {
1470
- if (fn) fn(data);
1471
- fireMethodResponse(data);
1472
- })
1473
- };
1474
- this.joinMember = function(id,tel,businessId,level,autoAnswer) {
1475
- id = id || account;
1476
- requestAsMeetMember('/joinMember',id,tel,level,businessId,autoAnswer);
1477
- };
1478
- this.joinVideoMember = function(id,tel,businessId,level,autoAnswer) {
1479
- id = id || account;
1480
- requestAsMeetMember('/joinVideoMember',id,tel,level,businessId,autoAnswer);
1481
- };
1482
- this.changeMemberLevel = function(id,tel,level) {
1483
- requestAsMeetMember('/changeMemberLevel',id,tel,level);
1484
- };
1485
- this.changeMemberToSpeaker = function(id,tel) {
1486
- self.changeMemberLevel(id, tel, "speak");
1487
- };
1488
- this.changeMemberToAudience = function(id,tel) {
1489
- self.changeMemberLevel(id, tel, "audience");
1490
- };
1491
- this.changeMemberToChairman = function(id,tel) {
1492
- self.changeMemberLevel(id, tel, "chairman");
1493
- };
1494
- function requestAsLiteMeetMember(path,id,tel) {
1495
- checkLogin();
1496
- $.getJSON(meetUrl(path), {'token':token,'id':id,'tel':tel}, function(data){
1497
- fireMethodResponse(data);
1498
- });
1499
- }
1500
- this.kickMember = function(id,tel) {
1501
- requestAsLiteMeetMember('/kickMember', id, tel);
1502
- };
1503
- this.privateTalk = function(id,tel) {
1504
- requestAsLiteMeetMember('/privateTalk', id, tel);
1505
- };
1506
- this.backToMeet = function(id,tel) {
1507
- requestAsLiteMeetMember('/backToMeet', id, tel);
1508
- };
1509
- }
1510
- function GroupPoc(){
1511
- var self = this;
1512
- //当前成员对讲状态集合pocNo:{pocNo,currentGroup,conPocNo,status,pttStatus}
1513
- var memStatus = {};
1514
- this.requestMemsStatus = function(fn) {
1515
- if(fn) { fn(memStatus); }
1516
- };
1517
- this.requestMemStatus = function(pocNo,fn) {
1518
- if(fn) { fn(memStatus[pocNo]); }
1519
- };
1520
- //当前对讲组状态 groupNo{groupId,groupNo,status}
1521
- var groupStatus = {};
1522
-
1523
- this.destroy = function() {
1524
- }
1525
- //更新对讲频道的状态数据
1526
- function updateGroupsStatus(data) {
1527
- var sts = groupStatus[data.groupNo];
1528
- if (sts) {
1529
- sts.groupNo = data.groupNo;
1530
- sts.status = data.status;
1531
- sts.isTmp = data.isTmp;
1532
- sts.maxMemNum = data.maxMemNum;
1533
- sts.num = data.num;
1534
- if(data.isTmp){//allMembers,wokings为临时频道特殊属性
1535
- sts.allMembers = data.allMembers;
1536
- sts.wokings = data.wokings;
1537
- }
1538
- if(data.status == "end" && data.isTmp) {//临时频道结束删除
1539
- delete groupStatus[data.groupNo];
1540
- } else {
1541
- groupStatus[data.groupNo] = sts;
1542
- }
1543
- } else {
1544
- if(data.status != "end") {//临时频道结束状态不做加入
1545
- sts = {
1546
- 'groupNo': data.groupNo,
1547
- 'status': data.status,
1548
- 'isTmp': data.isTmp,
1549
- 'maxMemNum':data.maxMemNum,
1550
- 'num':data.num
1551
- };
1552
- if(sts.isTmp){//allMembers,wokings为临时频道特殊属性
1553
- sts ['allMembers'] = data.allMembers;
1554
- sts ['wokings'] = data.wokings;
1555
- }
1556
- groupStatus[data.groupNo] = sts;
1557
- }
1558
- }
1559
- return sts;
1560
- }
1561
- //更新对讲成员的状态数据
1562
- function updateMemsStatus(data) {
1563
- //console.log(data);
1564
- var sts = memStatus[data.pocNo];
1565
- if (sts) {
1566
- sts.pocNo = data.pocNo;
1567
- sts.currentGroup = data.currentGroup;
1568
- sts.conPocNo = data.conPocNo;
1569
- sts.status = data.status;
1570
- sts.pttStatus = data.pttStatus;
1571
- } else {
1572
- memStatus[data.pocNo] = sts = {
1573
- 'pocNo': data.pocNo,
1574
- 'currentGroup': data.currentGroup,
1575
- 'conPocNo': data.conPocNo,
1576
- 'status': data.status,
1577
- 'pttStatus': data.pttStatus
1578
- };
1579
- }
1580
- return sts;
1581
- }
1582
- //话权状态变化
1583
- function memPttChange(data) {
1584
- var sts = memStatus[data.pocNo];
1585
-
1586
- var pttStatus = "";
1587
- if(data.pocStatus == "getted") {
1588
- pttStatus = "getted";
1589
- }
1590
- if (sts) {
1591
- sts.pocNo = data.pocNo;
1592
- sts.currentGroup = data.currentGroup;
1593
- sts.pttStatus = pttStatus;
1594
- memStatus[data.pocNo] = sts;
1595
- } else {
1596
- memStatus[data.pocNo] = sts = {
1597
- 'pocNo': data.pocNo,
1598
- 'currentGroup': data.currentGroup,
1599
- 'conPocNo': data.conPocNo,
1600
- 'status': "working",
1601
- 'pttStatus': pttStatus
1602
- };
1603
- }
1604
- return sts;
1605
- }
1606
-
1607
- this.requestGroupsStatus = function(fn) {
1608
- // console.log(groupStatus)
1609
- if(fn) { fn(groupStatus); }
1610
- };
1611
- //获取单个对讲频道
1612
- this.requestGroupStatus = function(groupNo,isTmp,fn) {
1613
- if(fn) {
1614
- if(!groupStatus[groupNo] || !isTmp) {
1615
- $.getJSON(groupPocUrl('/getPocGroupsStatus'), {'groupNo':groupNo,'isTmp':isTmp,'token':token}, function(data) {
1616
- // {code,total,data:[{meetId,meetName,recording,playvoice,locked,members:[{meetId,tel}]}]}
1617
- if (data && data.data ) {
1618
- updateGroupsStatus(data.data);
1619
- fn(data.data);
1620
- }
1621
- });
1622
- } else {
1623
- fn(groupStatus[groupNo]);
1624
- }
1625
- }
1626
- };
1627
- //对讲组相关api接口地址
1628
- function groupPocUrl(path) { return apiUrl('/groupPoc' + path); }
1629
-
1630
- /**对讲组切换通知*/
1631
- function onPocSwitchNotify(msg) {
1632
- //pocNo 对讲机号码;groupSwitchNo 切换到频道 ; pttNo 话权号码 为空值””,表示组中无人占用话权
1633
- //{"data":{"pocNo":"1008","groupSwitchNo":"5012","pttNo":""},"channel":"/poc/switch"}
1634
- var data = msg.data;
1635
- // console.log("对讲组切换通知");
1636
- // console.log(msg.data);
1637
- fireListens(event_const.POC_SWITCH_CHN, data);
1638
- }
1639
- /**话权状态通知*/
1640
- function onPocNotifyPttNotify(msg) {
1641
- //pocNo 对讲机号码
1642
- //currentGroup 当前所在组
1643
- //pocStatus 话权命令 apply(申请)/released(释放)
1644
- //{"data":{"pocTel":"1008","pocCmd":"apply"},"channel":"/poc/ptt"}
1645
- var data = msg.data;
1646
- memPttChange(data);
1647
- data = memStatus[data.pocNo]
1648
- fireListens(event_const.POC_MEM_CHN, data);
1649
- }
1650
- /**对讲成员状态通知*/
1651
- function onPocMemStatusNotify(msg) {
1652
- //pocNo 对讲机号码
1653
- //currentGroup 当前所在频道 若是单工点对点对讲则为空值
1654
- //conPocNo 关联对讲号码 单工点对点时,填写;其他状态为空值
1655
- //status 状态 值:idle|working
1656
- //pttStatus 话权状态 值:getted(获取到)
1657
- //pttCtrlStatus 话权控制状态:0-未控制; 1-已控制( ptt功能无效)
1658
- //{"data":{"pocNo":"1008","currentGroup":"","conPocNo":"","status":"","pttStatus":"","pttCtrlStatus":""},"channel":"/poc/memStatus"}
1659
- var data = msg.data;
1660
- updateMemsStatus(data);
1661
- fireListens(event_const.POC_MEM_CHN, data);
1662
- }
1663
- /**对讲频道状态通知*/
1664
- function onPocGroupStatusNotify(msg) {
1665
- //groupNo 频道
1666
- //status 状态 值:working|end
1667
- //type
1668
- //{"data":{"pocNo":"1008","status":"","isTmp":true,"allMembers":"1001|1002","wokings":"1001",maxMemNum,num,type},"channel":"/poc/groupStatus"}
1669
- var data = msg.data;
1670
- console.log(msg.data);
1671
- updateGroupsStatus(data);
1672
- fireListens(event_const.POC_GROUP_CHN, data);
1673
- }
1674
- /**对讲成员发起sos请求通知*/
1675
- function onPocMemSosNotify(msg) {
1676
- //pocNo 号码
1677
- //ctrlSosCmd open(开启);close(关闭);finish(结束)
1678
- //{"data":{"pocNo":"1008","ctrlSosCmd":"open","memName":"memName"},"channel":"/poc/memSos"}
1679
- var data = msg.data;
1680
- console.log(msg.data);
1681
- fireListens(event_const.POC_SOS_CHN, data);
1682
- }
1683
- /**对讲成员请求加入临时通话组通知*/
1684
- function onPocMemJoinGroupNotify(msg) {
1685
- //pocNo 号码
1686
- //groupNo 临时频道组
1687
- //type join:加入频道组; reject:拒绝加入频道组
1688
- //{"data":{"pocNo":"1008","groupNo":"1001","type":"join","memName":"memName"},"channel":"/poc/memJoinGroup"}
1689
- var data = msg.data;
1690
- console.log(msg.data);
1691
- fireListens(event_const.POC_MEM_JOIN_GROUP_CHN, data);
1692
- }
1693
- /**对讲组下在线成员数量变化通知*/
1694
- function onPocInLineNotify(msg) {
1695
- //groupNo 对讲频道
1696
- //status 当前所在组 值:working|end
1697
- //{"data":{"groupId":"1","groupNo":"332","num":"5","maxNum":"10"},"channel":"/poc/inLine"}
1698
- var data = msg.data;
1699
- fireListens(event_const.POC_GROUP_INLINE_CHN, data);
1700
- }
1701
- /**手机信号和电量通知*/
1702
- function onPocPhoneStatusNotify(msg) {
1703
- //electricQuantity 电量,百分比的数字
1704
- //signal 信号,等级0~4,其他表示不知信号级别=0
1705
- //{"data":{"id":"1","type":"phoneStatus","source":"app","data":{"memId":"1","electricQuantity":"25","signal":"0"}}}
1706
- var data = msg.data;
1707
- fireListens(event_const.POC_PHONE_STATUS_CHN, data);
1708
- }
1709
- //通知频道连接初始化
1710
- this.initialize = function(accId, corpId) {
1711
- var accTopic = accId? "/"+accId : ""; //主题通道追加账号标识
1712
- var corpTopic = corpId? "/"+corpId : ""; //主题通道追加分权id标识
1713
- sse.subscribe(accTopic + '/poc/switch', onPocSwitchNotify);
1714
- sse.subscribe(accTopic + '/poc/ptt', onPocNotifyPttNotify);
1715
- sse.subscribe(accTopic + '/poc/memStatus', onPocMemStatusNotify);
1716
- sse.subscribe(accTopic + '/poc/groupStatus', onPocGroupStatusNotify);
1717
- sse.subscribe(accTopic + '/poc/memSos', onPocMemSosNotify);
1718
- sse.subscribe(accTopic + '/poc/memJoinGroup', onPocMemJoinGroupNotify);
1719
- sse.subscribe(accTopic + '/poc/inLine', onPocInLineNotify);
1720
- sse.subscribe(corpTopic + '/poc/phoneStatus', onPocPhoneStatusNotify);
1721
- }
1722
- //获取当前所有对讲成员状态
1723
- this.listMemStatus = function(resultCallback) {
1724
- checkLogin();
1725
- $.getJSON(groupPocUrl('/listPocMemsStatus'), {'token':token}, function(data) {
1726
- // {code,total,data:[{meetId,meetName,recording,playvoice,locked,members:[{meetId,tel}]}]}
1727
- if (data && data.data && data.data.length) {
1728
- for (var i = 0; i < data.data.length; i++) {
1729
- updateMemsStatus(data.data[i]);
1730
- }
1731
- }
1732
- if (resultCallback) resultCallback(data);
1733
- });
1734
- }
1735
- //获取当前所有对讲频道状态
1736
- this.listGroupStatus = function(resultCallback) {
1737
- checkLogin();
1738
- $.getJSON(groupPocUrl('/listPocGroupsStatus'), {'token':token}, function(data) {
1739
- // {code,total,data:[{meetId,meetName,recording,playvoice,locked,members:[{meetId,tel}]}]}
1740
- if (data && data.data ) {
1741
- for (var i in data.data) {
1742
- updateGroupsStatus(data.data[i]);
1743
- }
1744
- }
1745
- if (resultCallback) resultCallback(data);
1746
- });
1747
- }
1748
- //获取当前所有的临时对讲频道
1749
- this.listTempPoc = function(fn) {
1750
- if(fn) {
1751
- var list = new Array();
1752
- for(var o in groupStatus){
1753
- if(groupStatus[o].isTmp == true){
1754
- list.push(groupStatus[o]);
1755
- }
1756
- }
1757
- fn(list);
1758
- }
1759
- }
1760
- //获取当前sos列表(请求 open状态)
1761
- this.listMemSos = function(fn) {
1762
- checkLogin();
1763
- $.getJSON(groupPocUrl('/listMemSos'), {'token':token}, function(data) {
1764
- // {code,total,data:[{pocNo,ctrlSosCmd:'open',memName}]}
1765
- if (fn) fn(data);
1766
- });
1767
- }
1768
- //获取手机状态列表
1769
- this.listPhoneStatus = function(fn) {
1770
- checkLogin();
1771
- $.getJSON(groupPocUrl('/listPhoneStatus'), {'token':token}, function(data) {
1772
- // {code,total,data:[{electricQuantity:电量数值,memId:{memId},signal:信号数值}]}
1773
- if (fn) fn(data);
1774
- });
1775
- }
1776
- //删除某个成员的sos请求
1777
- this.delMemSos = function(pocNo, fn) {
1778
- checkLogin();
1779
- $.getJSON(groupPocUrl('/delMemSos'), {'token':token,'pocNo':pocNo}, function(data) {
1780
- if (fn) fn(data);
1781
- });
1782
- }
1783
- //获取当前请求加入频道组的请求列表
1784
- this.listJoinGroupReq = function(fn) {
1785
- checkLogin();
1786
- $.getJSON(groupPocUrl('/listJoinGroupReq'), {'token':token}, function(data) {
1787
- // {code,total,data:[pocNo,groupNo,type:'join']}
1788
- if (fn) fn(data);
1789
- });
1790
- }
1791
- //根据对讲频道号对讲频道状态
1792
- this.getGroupStatus = function(groupNo,isTmp,resultCallback) {
1793
- checkLogin();
1794
- $.getJSON(groupPocUrl('/getPocGroupsStatus'), {'groupNo':groupNo,'isTmp':isTmp,'token':token}, function(data) {
1795
- // {code,total,data:[{meetId,meetName,recording,playvoice,locked,members:[{meetId,tel}]}]}
1796
- if (data && data.data ) {
1797
- updateGroupsStatus(data.data);
1798
- }
1799
- if (resultCallback) resultCallback(data);
1800
- });
1801
- }
1802
- function requestWithMeetId(path,id) {
1803
- checkLogin();
1804
- $.getJSON(groupPocUrl(path), {'token':token,'id':id}, function(data){
1805
- fireMethodResponse(data);
1806
- });
1807
- }
1808
-
1809
- /**
1810
- * 获取对讲频道的成员在线情况
1811
- */
1812
- this.getGroupMemOnlineNum = function(resultCallback) {
1813
- checkLogin();
1814
- var jsonData = {
1815
- 'token':token
1816
- }
1817
- $.getJSON(groupPocUrl("/listGroupNum"), jsonData, function(data){
1818
- fireMethodResponse(data);
1819
- if (resultCallback) resultCallback(data);
1820
- });
1821
- };
1822
-
1823
- /**发起对讲组呼叫
1824
- *整个对讲组呼起时:callNumber,groupId,groupNo
1825
- *点对点对讲时:callNumber,poc_no,groupId,
1826
- */
1827
- this.talkbackCall = function(callNumber,pocNo,groupId,groupNo,callType,resultCallback) {
1828
- checkLogin();
1829
- // if(callNumber !== '' && memStatus[callNumber] && memStatus[callNumber].status === 'working') {
1830
- // var resp = {
1831
- // 'data' : '[' + callNumber + ']不是空闲状态'
1832
- // }
1833
- // if (resultCallback) resultCallback(resp);
1834
- // alert('[' + callNumber + ']不是空闲状态,无法加入');
1835
- // return;
1836
- // }
1837
- var jsonData = {
1838
- 'token':token,
1839
- 'pocNo':pocNo,
1840
- 'callNumber':callNumber,
1841
- 'groupId':groupId,
1842
- "groupNo":groupNo,
1843
- "callType":callType
1844
- };
1845
- $.getJSON(groupPocUrl("/talkbackCall"), jsonData, function(data){
1846
- fireMethodResponse(data);
1847
- if (resultCallback) resultCallback(data);
1848
- });
1849
- };
1850
- /**结束对讲
1851
- * 结束点对点对讲填写时传入对讲机号码pocNo
1852
- * 结束组对讲填写时的对讲频道时传入groupNo
1853
- */
1854
- this.talkbackEnd = function(pocNo,groupNo) {
1855
- checkLogin();
1856
- $.getJSON(groupPocUrl("/talkbackEnd"), {'token':token,'pocNo':pocNo,'groupNo':groupNo}, function(data){
1857
- fireMethodResponse(data);
1858
- });
1859
- }
1860
- /**对讲组切换
1861
- * pocNo 切换的对讲号码
1862
- * groupSwitchNo 切换到组号
1863
- */
1864
- this.talkbackChange = function(pocNo,groupSwitchNo,resultCallback) {
1865
- console.log("pocNo:" + pocNo + "; groupSwitchNo: " + groupSwitchNo);
1866
- checkLogin();
1867
- $.getJSON(groupPocUrl("/talkbackChange"), {'token':token,'pocNo':pocNo,'groupSwitchNo':groupSwitchNo}, function(data){
1868
- resultCallback && resultCallback(data);
1869
- fireMethodResponse(data);
1870
- });
1871
- }
1872
- //话权处理状态数据 四种状态,当前/预处理 apply(申请)/released(释放)/applying(申请中)/releaseding(释放中)
1873
- /**
1874
- * 'pocNo':pocNo,
1875
- * "pocCmd":"",//applying(申请中)/releaseding(释放中)
1876
- * 'readyPocCmd': readyPocCmd // apply(申请)/released(释放)
1877
- */
1878
-
1879
- var telSpeakPower = {};
1880
- /**对讲组话权申请/释放
1881
- * pocNo 切换的对讲号码
1882
- * pocCmd 话权命令,apply(申请)/released(释放)
1883
- */
1884
- this.speakPower = function(pocNo,pocCmd,groupNo,resultCallback) {
1885
- checkLogin();
1886
- var telSpeakPowerNow = telSpeakPower[pocNo];
1887
- if(telSpeakPowerNow){
1888
- //正在处理话权变化中中
1889
- if(telSpeakPowerNow.pocCmd !="" ){
1890
- //将非相同的操作放入预处理中
1891
- if((telSpeakPowerNow.pocCmd == "applying" && pocCmd == "released") ||
1892
- (telSpeakPowerNow.pocCmd == "releaseding" && pocCmd == "apply")) {
1893
- telSpeakPowerNow.readyPocCmd = pocCmd;
1894
- }
1895
- telSpeakPower[pocNo] = telSpeakPowerNow;
1896
- } else {
1897
- //没有正在处理出的话权.开始处理话权
1898
- if(pocCmd == "apply") {
1899
- telSpeakPowerNow.pocCmd = "applying";
1900
- } else if(pocCmd == "released"){
1901
- telSpeakPowerNow.pocCmd = "releaseding";
1902
- }
1903
- telSpeakPower[pocNo] = telSpeakPowerNow;
1904
- startSpeakPower(telSpeakPowerNow,groupNo,resultCallback);
1905
- }
1906
- } else {
1907
- //号码第一次做话权的变化,增加新的话权变化数据记录
1908
- telSpeakPowerNow = {
1909
- 'pocNo':pocNo,
1910
- 'pocCmd':'',
1911
- 'readyPocCmd': ""
1912
- };
1913
- if(pocCmd == "apply") {
1914
- telSpeakPowerNow.pocCmd = "applying";
1915
- } else if(pocCmd == "released"){
1916
- telSpeakPowerNow.pocCmd = "releaseding";
1917
- }
1918
- telSpeakPower[pocNo] = telSpeakPowerNow;
1919
- startSpeakPower(telSpeakPowerNow, groupNo, resultCallback);
1920
- }
1921
- }
1922
-
1923
- function startSpeakPower(speakPowerJson,groupNo, resultCallback) {
1924
- var pocCmd = "released";
1925
- if(speakPowerJson.pocCmd == "applying") {
1926
- pocCmd = "apply";
1927
- }
1928
- $.getJSON(groupPocUrl("/speakPower"), {'token':token,'pocNo':speakPowerJson.pocNo,'pocCmd':pocCmd,"groupNo":groupNo}, function(data){
1929
- if (resultCallback) resultCallback(data);
1930
- fireMethodResponse(data);
1931
- //号码对应的状态不存在/号码的状态和预加载的状态不一致 发起新的话权变化请求
1932
- var telSpeakPowerNow = telSpeakPower[speakPowerJson.pocNo];
1933
- if(telSpeakPowerNow.readyPocCmd == ""){
1934
- //没有预处理的话权
1935
- telSpeakPowerNow.pocCmd = "";
1936
- } else {
1937
- //开始预处理 apply(申请)/released(释放)/applying(申请中)/releaseding(释放中)
1938
- if(telSpeakPowerNow.readyPocCmd == "apply") {
1939
- telSpeakPowerNow.pocCmd = "applying";
1940
- } else if(telSpeakPowerNow.readyPocCmd == "released") {
1941
- telSpeakPowerNow.pocCmd = "releaseding";
1942
- }
1943
- // 规避申请话权时不传组号的问题
1944
- if (telSpeakPowerNow.pocCmd !== "applying" || groupNo) {
1945
- startSpeakPower(telSpeakPowerNow, groupNo);
1946
- }
1947
-
1948
- telSpeakPowerNow.readyPocCmd = "";
1949
- }
1950
- telSpeakPower[telSpeakPowerNow.pocNo] = telSpeakPowerNow;
1951
- });
1952
- }
1953
-
1954
- //创建对讲组和成员groupJsonData ={"memIds":,"groupName":,"groupLevel":,}
1955
- this.createPocGroup = function(groupJsonData, resultCallback) {
1956
- checkLogin();
1957
- var jsonData = {
1958
- "token":token,
1959
- "groupLevel":1,
1960
- "groupType":1,
1961
- "groupName":""
1962
- };
1963
- //判断对讲组名称
1964
- if(groupJsonData.groupName && "" != groupJsonData.groupName){
1965
- jsonData.groupName = groupJsonData.groupName;
1966
- }
1967
- //判断对讲组等级
1968
- if(groupJsonData.groupLevel && "" != groupJsonData.groupLevel){
1969
- jsonData.groupLevel = groupJsonData.groupLevel;
1970
- }
1971
-
1972
- $.getJSON(_groupUrl("/addNewPocGroup"), jsonData, function(data){
1973
- if(data.code == 0) {
1974
- $.getJSON(_groupUrl("/addGroupMember"),
1975
- {'token':token,'memIds':groupJsonData.memIds,'groupId':data.data.id}, function(data2){
1976
- if(data2.code == 0){
1977
- if (resultCallback) resultCallback(data);
1978
- fireMethodResponse(data);
1979
- }
1980
- });
1981
- }
1982
- });
1983
- }
1984
- //删除对讲频道
1985
- this.deleteGroup = function(groupId,resultCallback) {
1986
- checkLogin();
1987
- $.getJSON(_groupUrl("/deleteTemporaryPocGroup"), {'token':token,'groupId':groupId}, function(data){
1988
- if (resultCallback) resultCallback(data);
1989
- fireMethodResponse(data);
1990
- });
1991
- }
1992
- //向对讲频道添加新的成员
1993
- this.joinGroupMem = function(groupId,memId,resultCallback) {
1994
- checkLogin();
1995
- $.getJSON(_groupUrl("/addGroupMember"), {'token':token,'groupId':groupId,"memIds":memId},function(data){
1996
- if (resultCallback) resultCallback(data);
1997
- fireMethodResponse(data);
1998
- });
1999
- }
2000
- //将成员移除对讲频道
2001
- this.removeGroupMem = function(groupId,memIds,resultCallback) {
2002
- checkLogin();
2003
- $.getJSON(_groupUrl("/removeGroupMem"), {'token':token,'groupId':groupId,"memIds":memIds},function(data){
2004
- if (resultCallback) resultCallback(data);
2005
- fireMethodResponse(data);
2006
- });
2007
- }
2008
- //获取所有的对讲组
2009
- this.getPocGroups = function(resultCallback) {
2010
- checkLogin();
2011
- $.getJSON(_groupUrl("/list"), {'token':token,'groupType':"poc"},function(data){
2012
- if (resultCallback) resultCallback(data);
2013
- fireMethodResponse(data);
2014
- });
2015
- }
2016
- //获取对讲组下的所有成员
2017
- this.getPocGroupMem = function(id,resultCallback) {
2018
- checkLogin();
2019
- $.getJSON(_groupUrl("/listMembers"), {'token':token,'id':id},function(data){
2020
- if (resultCallback) resultCallback(data);
2021
- fireMethodResponse(data);
2022
- });
2023
- }
2024
- this.getDisPatchOperInfo = function(token,resultCallback){
2025
- if(token == null || token == "") {
2026
- return;
2027
- }
2028
- $.getJSON(apiUrl('/conn/getDispatchOper'),{"token":token}, function(data) {
2029
- if (resultCallback) resultCallback(data);
2030
- fireMethodResponse(data);
2031
- });
2032
- }
2033
- this.creatTmpPoc = function(resultCallback) {
2034
- checkLogin();
2035
- $.getJSON(groupPocUrl("/creatTmpPoc"), {'token':token},function(data){
2036
- if (resultCallback) resultCallback(data);
2037
- fireMethodResponse(data);
2038
- });
2039
- }
2040
- this.leaveTmpPocMembers = function(callNumber,groupNo,resultCallback) {
2041
- checkLogin();
2042
- $.getJSON(groupPocUrl("/leaveTmpPocMembers"), {'token':token,'callNumber':callNumber,'groupNo':groupNo},function(data){
2043
- if (resultCallback) resultCallback(data);
2044
- fireMethodResponse(data);
2045
- });
2046
- }
2047
- //打开云眼
2048
- this.openCloudEye = function(pocNo,resultCallback) {
2049
- checkLogin();
2050
- $.getJSON(groupPocUrl("/openCloudEye"), {'token':token,'pocNo':pocNo},function(data){
2051
- if (resultCallback) resultCallback(data);
2052
- fireMethodResponse(data);
2053
- });
2054
- }
2055
- //关闭云眼
2056
- this.closeCloudEye = function(pocNo,resultCallback) {
2057
- checkLogin();
2058
- $.getJSON(groupPocUrl("/closeCloudEye"), {'token':token,'pocNo':pocNo},function(data){
2059
- if (resultCallback) resultCallback(data);
2060
- fireMethodResponse(data);
2061
- });
2062
- }
2063
- //拒绝加入临时组
2064
- this.rejectJoinGroup = function(pocNo, groupNo, resultCallback) {
2065
- checkLogin();
2066
- $.getJSON(groupPocUrl("/rejectJoinGroup"), {'token':token,'pocNo':pocNo,'groupNo':groupNo},function(data){
2067
- if (resultCallback) resultCallback(data);
2068
- fireMethodResponse(data);
2069
- });
2070
- }
2071
- this.delJoinGroup = function(pocNo, groupNo, resultCallback) {
2072
- checkLogin();
2073
- $.getJSON(groupPocUrl("/delJoinGroup"), {'token':token,'pocNo':pocNo,'groupNo':groupNo},function(data){
2074
- if (resultCallback) resultCallback(data);
2075
- fireMethodResponse(data);
2076
- });
2077
- }
2078
- //话权控制
2079
- this.ctrlPocMems = function(pocMembers, groupNo, ctrlPPTCmd, resultCallback) {
2080
- checkLogin();
2081
- $.getJSON(groupPocUrl("/ctrlPocMems"), {'token':token,'pocMembers':pocMembers,'groupNo':groupNo,'ctrlPPTCmd':ctrlPPTCmd},function(data){
2082
- if (resultCallback) resultCallback(data);
2083
- fireMethodResponse(data);
2084
- });
2085
- }
2086
- }
2087
- };
2088
-
2089
- /** 子页面中的;通过引用来调用主页面中的功能(相同域名下) */
2090
- function DispatchSub() {
2091
- // 如果在与主连接在同一域名下,则直接通过框架引用对象
2092
-
2093
- // 对主框架中 scooper.dispatch 的引用(相同域名下)
2094
- var dispatch = null;
2095
- //
2096
- this.initialize = function() {
2097
- var topFrame = findMainFrame();
2098
- dispatch = topFrame.scooper.dispatch;
2099
- };
2100
- this.destroy = function() {
2101
- dispatch = null;
2102
- };
2103
- this.getToken = function() {
2104
- checkInit();
2105
- return dispatch.getToken();
2106
- };
2107
- this.setToken = function(val) {
2108
- checkInit();
2109
- dispatch.setToken(val);
2110
- };
2111
- this.getAccountToken = function() {
2112
- checkInit();
2113
- if (dispatch.hasOwnProperty('getAccountToken')) {
2114
- return dispatch.getAccountToken();
2115
- }
2116
- return '';
2117
- }
2118
- this.setAccountToken = function(val) {
2119
- checkInit();
2120
- if (dispatch.hasOwnProperty('setAccountToken')) {
2121
- dispatch.setAccountToken(val);
2122
- }
2123
- }
2124
- this.setScooperIp = function(val) {
2125
- checkInit();
2126
- if (dispatch.hasOwnProperty('setScooperIp')) {
2127
- dispatch.setScooperIp(val);
2128
- }
2129
- }
2130
- //数据加载
2131
- this.loadData = {
2132
- 'notifyRecordFile': function(){
2133
- checkInit();
2134
- return dispatch.loadData.notifyRecordFile();
2135
- }
2136
- };
2137
-
2138
- this.getAccountByToken = function(accountToken, clb) {
2139
- checkInit();
2140
- if (dispatch.hasOwnProperty('getAccountByToken')) {
2141
- dispatch.getAccountByToken(accountToken, clb);
2142
- }
2143
- }
2144
-
2145
- this.sendChangeCfg = function(type,value,fn) {
2146
- checkInit();
2147
- dispatch.sendChangeCfg(type, value, fn);
2148
- };
2149
- //
2150
- function checkInit() {
2151
- if (!dispatch) {
2152
- throw new Error("not initialized");
2153
- }
2154
- }
2155
- //
2156
- this.login = function(user,pass) { /* do nothing */ };
2157
- //
2158
- this.loginByToken = function(token, fn){ //父层已登录,子层只做转台反馈
2159
- $.getJSON(apiUrl('/conn/connectionByToken'), {'token': token}, function(ret) {
2160
- if(fn) fn(ret);
2161
- });
2162
- };
2163
-
2164
- this.setloginExamine = function(loginExamines){};
2165
- this.logout = function() { /* do nothing */ };
2166
- //
2167
- this.listen = function(evtType,fn) {
2168
- checkInit();
2169
- dispatch.listen(evtType,fn);
2170
- };
2171
- this.unlisten = function(evtType,fn) {
2172
- checkInit();
2173
- dispatch.unlisten(evtType,fn);
2174
- };
2175
- this.getDispatchOper = function() {
2176
- checkInit();
2177
- return dispatch.getDispatchOper();
2178
- };
2179
- // 呼叫相关操作
2180
- this.calls = {
2181
- 'requestCallStatus': function(fn) {
2182
- checkInit();
2183
- dispatch.calls.requestCallStatus(fn);
2184
- },
2185
- 'requestTelStatus': function(tel,fn) {
2186
- checkInit();
2187
- dispatch.calls.requestTelStatus(tel,fn);
2188
- },
2189
- 'requestCallIns': function(fn) {
2190
- checkInit();
2191
- dispatch.calls.requestCallIns(fn);
2192
- },
2193
- 'listStatus': function(resultCallback) {
2194
- checkInit();
2195
- dispatch.calls.listStatus(resultCallback);
2196
- },
2197
- 'listCallIn': function(resultCallback) {
2198
- checkInit();
2199
- dispatch.calls.listCallIn(resultCallback);
2200
- },
2201
- /** 呼叫 */
2202
- 'makeCall': function(tel, businessId) {
2203
- checkInit();
2204
- dispatch.calls.makeCall(tel, businessId);
2205
- },
2206
- /** 视频呼叫 */
2207
- 'makeVideoCall': function(tel, businessId) {
2208
- checkInit();
2209
- dispatch.calls.makeVideoCall(tel, businessId);
2210
- },
2211
- 'hungUp': function(tel) {
2212
- checkInit();
2213
- dispatch.calls.hungUp(tel);
2214
- },
2215
- /** 应答 */
2216
- 'answer': function(tel, businessId) {
2217
- checkInit();
2218
- dispatch.calls.answer(tel, businessId);
2219
- },
2220
- 'answerAll': function(tel) {
2221
- checkInit();
2222
- dispatch.calls.answerAll();
2223
- },
2224
- "rollCall": function(tels) {
2225
- checkInit();
2226
- dispatch.calls.rollCall(tels);
2227
- },
2228
- "stopRollCall": function() {
2229
- checkInit();
2230
- dispatch.calls.stopRollCall();
2231
- },
2232
- "groupTurn": function(tels, isOnce) {
2233
- checkInit();
2234
- dispatch.calls.groupTurn(tels, isOnce);
2235
- },
2236
- 'hold': function(tel) {
2237
- checkInit();
2238
- dispatch.calls.hold(tel);
2239
- },
2240
- 'unhold': function(tel) {
2241
- checkInit();
2242
- dispatch.calls.unhold(tel);
2243
- },
2244
- /** 转接 */
2245
- 'transfer': function(from,to, businessId) {
2246
- checkInit();
2247
- dispatch.calls.transfer(from,to, businessId);
2248
- },
2249
- 'retrieve': function(tel) {
2250
- checkInit();
2251
- dispatch.calls.retrieve(tel);
2252
- },
2253
- 'tripleMonitor': function(tel) {
2254
- checkInit();
2255
- dispatch.calls.tripleMonitor(tel);
2256
- },
2257
- 'tripleBreakin': function(tel) {
2258
- checkInit();
2259
- dispatch.calls.tripleBreakin(tel);
2260
- },
2261
- 'tripleHungup': function(tel) {
2262
- checkInit();
2263
- dispatch.calls.tripleHungup(tel);
2264
- },
2265
- 'callRecord': function(tel) {
2266
- checkInit();
2267
- dispatch.calls.callRecord(tel);
2268
- },
2269
- 'callRecordEnd': function(tel) {
2270
- checkInit();
2271
- dispatch.calls.callRecordEnd(tel);
2272
- },
2273
- 'groupCall': function(groupId,autoAnswer,allAudience) {
2274
- checkInit();
2275
- dispatch.calls.groupCall(groupId,autoAnswer,allAudience);
2276
- },
2277
- 'groupCancel': function(groupId) {
2278
- checkInit();
2279
- dispatch.calls.groupCancel(groupId);
2280
- },
2281
- 'selectCall': function(tels,autoAnswer,allAudience) {
2282
- checkInit();
2283
- dispatch.calls.selectCall(tels,autoAnswer,allAudience);
2284
- },
2285
- 'selectCancel': function() {
2286
- checkInit();
2287
- dispatch.calls.selectCancel();
2288
- },
2289
- 'groupSame' : function(memIds,autoAnswer,allAudience) {
2290
- checkInit();
2291
- dispatch.calls.groupSame(memIds,autoAnswer,allAudience);
2292
- },
2293
- 'groupNotify': function(groupId,files,type,times,notifyId) {
2294
- checkInit();
2295
- dispatch.calls.groupNotify(groupId,files,type,times,notifyId);
2296
- },
2297
- 'selectNotify': function(tels,files,type,times,notifyId,confirm) {
2298
- checkInit();
2299
- dispatch.calls.selectNotify(tels,files,type,times,notifyId,confirm);
2300
- },
2301
- 'makeCallSame': function(tels, meetId) {
2302
- checkInit();
2303
- dispatch.calls.makeCallSame(tels, meetId);
2304
- },
2305
- 'openVideo': function(callNumber,callId,businessId,avRecord) {
2306
- checkInit();
2307
- dispatch.calls.openVideo(callNumber,callId,businessId,avRecord);
2308
- },
2309
- 'closeVideo': function(callNumber) {
2310
- checkInit();
2311
- dispatch.calls.closeVideo(callNumber);
2312
- },
2313
- 'notifyRecordOP': function(tel, title, opType, filename) {
2314
- checkInit();
2315
- dispatch.calls.notifyRecordOP(tel, title, opType, filename);
2316
- }
2317
- };
2318
- // 会议相关操作
2319
- this.meets = {
2320
- 'requestMeets': function(fn) {
2321
- checkInit();
2322
- dispatch.meets.requestMeets(fn);
2323
- },
2324
- 'requestMeet': function(id, fn) {
2325
- checkInit();
2326
- dispatch.meets.requestMeet(id, fn);
2327
- },
2328
- 'requestMeetMembers': function(id,fn) {
2329
- checkInit();
2330
- dispatch.meets.requestMeetMembers(id,fn);
2331
- },
2332
- 'requestMeetMember': function(meetId,tel,fn) {
2333
- checkInit();
2334
- dispatch.meets.requestMeetMember(meetId,tel,fn);
2335
- },
2336
- 'listMeets': function(fn) {
2337
- checkInit();
2338
- dispatch.meets.listMeets(fn);
2339
- },
2340
- 'getMeet': function(id, fn) {
2341
- checkInit();
2342
- dispatch.meets.getMeet(id, fn);
2343
- },
2344
- 'createMeet': function(name, businessId,resultCallback) {
2345
- checkInit();
2346
- dispatch.meets.createMeet(name, businessId,resultCallback);
2347
- },
2348
- 'createMeetDetail': function(name, businessId, resultCallback, meetAccess, meetAttr, timeBegin,
2349
- timeEnd, passwdSpeaker, passwdAudience, meetMembers, defineAttr) {
2350
- checkInit();
2351
- dispatch.meets.createMeetDetail(name, businessId,resultCallback, meetAccess, meetAttr, timeBegin,
2352
- timeEnd, passwdSpeaker, passwdAudience, meetMembers, defineAttr);
2353
- },
2354
- 'editMeet': function(meetId, meetName, resultCallback, meetAccess, meetAttr, timeBegin,
2355
- timeEnd, passwdSpeaker, passwdAudience, meetMembers) {
2356
- checkInit();
2357
- dispatch.meets.editMeet(meetId, meetName, resultCallback, meetAccess, meetAttr, timeBegin,
2358
- timeEnd, passwdSpeaker, passwdAudience, meetMembers);
2359
- },
2360
- 'endMeet': function(id) {
2361
- checkInit();
2362
- dispatch.meets.endMeet(id);
2363
- },
2364
- 'destroyMeet': function(id) {
2365
- checkInit();
2366
- dispatch.meets.destroyMeet(id);
2367
- },
2368
- 'lock': function(id) {
2369
- checkInit();
2370
- dispatch.meets.lock(id);
2371
- },
2372
- 'unlock': function(id) {
2373
- checkInit();
2374
- dispatch.meets.unlock(id);
2375
- },
2376
- 'startRecord': function(id) {
2377
- checkInit();
2378
- dispatch.meets.startRecord(id);
2379
- },
2380
- 'stopRecord': function(id) {
2381
- checkInit();
2382
- dispatch.meets.stopRecord(id);
2383
- },
2384
- 'startPlayVoice': function(id) {
2385
- checkInit();
2386
- dispatch.meets.startPlayVoice(id);
2387
- },
2388
- 'stopPlayVoice': function(id) {
2389
- checkInit();
2390
- dispatch.meets.stopPlayVoice(id);
2391
- },
2392
- 'getMeetRecord': function(id, tel, fn) {
2393
- checkInit();
2394
- dispatch.meets.getMeetRecord(id, tel, fn);
2395
- },
2396
- 'joinMember': function(id, tel, businessId, level, autoAnswer) {
2397
- checkInit();
2398
- dispatch.meets.joinMember(id,tel,businessId,level,autoAnswer);
2399
- },
2400
- 'joinVideoMember': function(id, tel, businessId, level, autoAnswer) {
2401
- checkInit();
2402
- dispatch.meets.joinVideoMember(id,tel,businessId,level,autoAnswer);
2403
- },
2404
- 'changeMemberLevel': function(id, tel, level) {
2405
- checkInit();
2406
- dispatch.meets.changeMemberLevel(id,tel,level);
2407
- },
2408
- 'changeMemberToSpeaker': function(id, tel) {
2409
- checkInit();
2410
- dispatch.meets.changeMemberToSpeaker(id,tel);
2411
- },
2412
- 'changeMemberToAudience': function(id, tel) {
2413
- checkInit();
2414
- dispatch.meets.changeMemberToAudience(id,tel);
2415
- },
2416
- 'changeMemberToChairman': function(id, tel) {
2417
- checkInit();
2418
- dispatch.meets.changeMemberToChairman(id,tel);
2419
- },
2420
- 'kickMember': function(id, tel) {
2421
- checkInit();
2422
- dispatch.meets.kickMember(id, tel);
2423
- },
2424
- 'privateTalk': function(id, tel) {
2425
- checkInit();
2426
- dispatch.meets.privateTalk(id, tel);
2427
- },
2428
- 'backToMeet': function(id, tel) {
2429
- checkInit();
2430
- dispatch.meets.backToMeet(id, tel);
2431
- }
2432
- };
2433
- //对讲组相关操作
2434
- this.groupPoc = {
2435
- 'requestMemsStatus': function(fn) {
2436
- checkInit();
2437
- dispatch.groupPoc.requestMemsStatus(fn);
2438
- },
2439
- 'requestMemStatus': function(pocNo,fn) {
2440
- checkInit();
2441
- dispatch.groupPoc.requestMemStatus(pocNo,fn);
2442
- },
2443
- 'requestGroupsStatus': function(fn) {
2444
- checkInit();
2445
- dispatch.groupPoc.requestGroupsStatus(fn);
2446
- },
2447
- 'requestGroupStatus': function(groupNo,isTmp,fn) {
2448
- checkInit();
2449
- dispatch.groupPoc.requestGroupStatus(groupNo,isTmp,fn);
2450
- },
2451
- 'listMemStatus': function(fn) {
2452
- checkInit();
2453
- dispatch.groupPoc.listMemStatus(fn);
2454
- },
2455
- 'listGroupStatus': function(fn) {
2456
- checkInit();
2457
- dispatch.groupPoc.listGroupStatus(fn);
2458
- },
2459
- 'listTempPoc' : function(fn) {
2460
- checkInit();
2461
- dispatch.groupPoc.listTempPoc(fn);
2462
- },
2463
- 'listMemSos': function(fn) {
2464
- checkInit();
2465
- dispatch.groupPoc.listMemSos(fn);
2466
- },
2467
- 'listPhoneStatus': function(fn) {
2468
- checkInit();
2469
- dispatch.groupPoc.listPhoneStatus(fn);
2470
- },
2471
- 'delMemSos': function(pocNo, fn) {
2472
- checkInit();
2473
- dispatch.groupPoc.delMemSos(pocNo, fn);
2474
- },
2475
- 'listJoinGroupReq': function(fn) {
2476
- checkInit();
2477
- dispatch.groupPoc.listJoinGroupReq(fn);
2478
- },
2479
- 'getGroupStatus': function(groupNo,isTmp,resultCallback) {
2480
- checkInit();
2481
- dispatch.groupPoc.getGroupStatus(groupNo,isTmp,resultCallback);
2482
- },
2483
- 'getGroupMemOnlineNum':function(resultCallback){
2484
- checkInit();
2485
- dispatch.groupPoc.getGroupMemOnlineNum(resultCallback);
2486
- },
2487
- 'talkbackCall': function(callNumber,pocNo,groupId,groupNo,callType,resultCallback) {
2488
- checkInit();
2489
- dispatch.groupPoc.talkbackCall(callNumber,pocNo,groupId,groupNo,callType,resultCallback);
2490
- },
2491
- 'talkbackEnd': function(pocNo,groupNo) {
2492
- checkInit();
2493
- dispatch.groupPoc.talkbackEnd(pocNo,groupNo);
2494
- },
2495
- 'talkbackChange': function(pocNo,groupSwitchNo,resultCallback) {
2496
- checkInit();
2497
- dispatch.groupPoc.talkbackChange(pocNo,groupSwitchNo,resultCallback);
2498
- },
2499
- 'speakPower': function(pocNo, pocCmd, groupNo, resultCallback) {
2500
- checkInit();
2501
- dispatch.groupPoc.speakPower(pocNo, pocCmd, groupNo, resultCallback);
2502
- },
2503
- 'createPocGroup': function(groupJsonData, resultCallback) {
2504
- checkInit();
2505
- dispatch.groupPoc.createPocGroup(groupJsonData, resultCallback);
2506
- },
2507
- 'deleteGroup': function(groupId,resultCallback) {
2508
- checkInit();
2509
- dispatch.groupPoc.deleteGroup(groupId,resultCallback);
2510
- },
2511
- 'joinGroupMem': function(groupId,memId,resultCallback) {
2512
- checkInit();
2513
- dispatch.groupPoc.joinGroupMem(groupId,memId,resultCallback);
2514
- },
2515
- 'removeGroupMem': function(groupId, memIds,resultCallback) {
2516
- checkInit();
2517
- dispatch.groupPoc.removeGroupMem(groupId,memIds,resultCallback);
2518
- },
2519
- 'getPocGroups': function(resultCallback) {
2520
- checkInit();
2521
- dispatch.groupPoc.getPocGroups(resultCallback);
2522
- },
2523
- 'getPocGroupMem': function(id,resultCallback) {
2524
- checkInit();
2525
- dispatch.groupPoc.getPocGroupMem(id,resultCallback);
2526
- },
2527
- 'getDisPatchOperInfo': function(token,resultCallback){
2528
- checkInit();
2529
- dispatch.groupPoc.getDisPatchOperInfo(token,resultCallback);
2530
- },
2531
- 'creatTmpPoc' : function(resultCallback){
2532
- checkInit();
2533
- dispatch.groupPoc.creatTmpPoc(resultCallback);
2534
- },
2535
- 'leaveTmpPocMembers' : function(callNumber,groupNo,resultCallback) {
2536
- checkInit();
2537
- dispatch.groupPoc.leaveTmpPocMembers(callNumber,groupNo,resultCallback);
2538
- },
2539
- 'openCloudEye' : function(pocNo,resultCallback) {
2540
- checkInit();
2541
- dispatch.groupPoc.openCloudEye(pocNo,resultCallback);
2542
- },
2543
- 'closeCloudEye' : function(pocNo,resultCallback) {
2544
- checkInit();
2545
- dispatch.groupPoc.closeCloudEye(pocNo,resultCallback);
2546
- },
2547
- 'rejectJoinGroup': function(pocNo, groupNo, resultCallback) {
2548
- checkInit();
2549
- dispatch.groupPoc.rejectJoinGroup(pocNo, groupNo, resultCallback);
2550
- },
2551
- 'delJoinGroup': function(pocNo, groupNo, resultCallback) {
2552
- checkInit();
2553
- dispatch.groupPoc.delJoinGroup(pocNo, groupNo, resultCallback);
2554
- },
2555
- 'ctrlPocMems': function(pocMembers, groupNo, ctrlPPTCmd, resultCallback) {
2556
- checkInit();
2557
- dispatch.groupPoc.ctrlPocMems(pocMembers, groupNo, ctrlPPTCmd, resultCallback);
2558
- }
2559
- };
2560
- }
2561
-
2562
- /** 跨域调用(子页面、顶层框架) */
2563
- function DispatchXDomain() {
2564
- // TODO 与使用 dispatch 的框架处于不同域名,则通过发送消息来实现;
2565
-
2566
- this.initialize = function() {
2567
- //
2568
- };
2569
- this.destroy = function() {
2570
- //
2571
- };
2572
- };
2573
-
2574
- /** 封装各层框架中的实现 */
2575
- function DispatchProxy() {
2576
- var self = this;
2577
- //
2578
- var _type = null;
2579
- var dispatch = null;
2580
- //
2581
- function checkInit() {
2582
- if (!dispatch) {
2583
- throw new Error("not initialized");
2584
- }
2585
- }
2586
-
2587
- /** 如果与调度网页后台处于不同域名,则需要在一开始就设置该值为调度网页后台的地址(包含 contextPath ) */
2588
- this.setRemoteBaseUrl = function(val) {
2589
- remoteBaseUrl = val;
2590
- if (dispatch && dispatch.hasOwnProperty('setRemoteBaseUrl')) {
2591
- dispatch.setRemoteBaseUrl(val);
2592
- }
2593
- };
2594
- /** 获取当前调用方式:main, sub, xdomain */
2595
- this.getType = function() {
2596
- return _type;
2597
- };
2598
- //
2599
- this.getToken = function() {
2600
- if (dispatch.hasOwnProperty('getToken')) {
2601
- return dispatch.getToken();
2602
- }
2603
- return '';
2604
- }
2605
- this.setToken = function(val) {
2606
- if (dispatch.hasOwnProperty('setToken')) {
2607
- dispatch.setToken(val);
2608
- }
2609
- }
2610
- //
2611
- this.isConnected = function() {
2612
- if (dispatch.hasOwnProperty('isConnected')) {
2613
- return dispatch.isConnected();
2614
- }
2615
- return false;
2616
- }
2617
-
2618
- /** 登录账号的 token;当采用js方式内嵌到其它共用 DB_SC_CORE.T_ACCOUNT 的程序可实现后台自动登录; */
2619
- this.getAccountToken = function() {
2620
- if (dispatch.hasOwnProperty('getAccountToken')) {
2621
- return dispatch.getAccountToken();
2622
- }
2623
- return '';
2624
- }
2625
- this.setAccountToken = function(val) {
2626
- if (dispatch.hasOwnProperty('setAccountToken')) {
2627
- dispatch.setAccountToken(val);
2628
- }
2629
- }
2630
- this.setScooperIp = function(val) {
2631
- if(dispatch.hasOwnProperty('setScooperIp')) {
2632
- dispatch.setScooperIp(val);
2633
- }
2634
- }
2635
-
2636
- //数据加载
2637
- this.loadData = {
2638
- 'notifyRecordFile': function(){
2639
- checkInit();
2640
- return dispatch.loadData.notifyRecordFile();
2641
- }
2642
- };
2643
-
2644
- this.getAccountByToken = function(accountToken, clb) {
2645
- if (dispatch.hasOwnProperty('getAccountByToken')) {
2646
- dispatch.getAccountByToken(accountToken, clb);
2647
- }
2648
- }
2649
-
2650
- /**
2651
- * 初始化
2652
- * @param type main - 作为主框架存在;sub - 是作为子页面的组件存在;xdomain - 跨域调用
2653
- */
2654
- this.initialize = function(type) {
2655
- try {
2656
- if(!type && window.top != window && window.top.scooper.dispatch) {
2657
- type = "sub";
2658
- }
2659
- } catch (error) {
2660
- //当跨域,或者top.scooper不存在时
2661
- }
2662
- if (!type)type = "main";
2663
-
2664
- console.log(type);
2665
- switch(type) {
2666
- case "main": dispatch = new Dispatch(); break;
2667
- case "sub" : dispatch = new DispatchSub(); break;
2668
- case "xdomain": dispatch = new DispatchXDomain(); break;
2669
- default: throw new Error("unknow type : " + type);
2670
- }
2671
- _type = type;
2672
- //
2673
- if (remoteBaseUrl) {
2674
- self.setRemoteBaseUrl(remoteBaseUrl);
2675
- }
2676
- //
2677
- dispatch.initialize();
2678
- };
2679
- this.destroy = function() {
2680
- checkInit();
2681
- dispatch.destroy();
2682
- };
2683
- //
2684
- this.login = function(user,pass) {
2685
- checkInit();
2686
- dispatch.login(user,pass);
2687
- };
2688
- //
2689
- this.setloginExamine = function(loginExamines){
2690
- checkInit();
2691
- dispatch.setloginExamine(loginExamines);
2692
- }
2693
- //
2694
- this.loginByToken = function(token, fn) {
2695
- checkInit();
2696
- dispatch.loginByToken(token, fn);
2697
- };
2698
- this.logout = function() {
2699
- checkInit();
2700
- dispatch.logout();
2701
- };
2702
- this.sendChangeCfg = function(type,value,fn) {
2703
- checkInit();
2704
- dispatch.sendChangeCfg(type, value, fn);
2705
- };
2706
- this.listen = function(evtType,fn) {
2707
- checkInit();
2708
- dispatch.listen(evtType, fn);
2709
- };
2710
- this.unlisten = function(evtType, fn) {
2711
- checkInit();
2712
- dispatch.unlisten(evtType, fn);
2713
- };
2714
- this.getDispatchOper = function() {
2715
- checkInit();
2716
- return dispatch.getDispatchOper();
2717
- };
2718
- // 呼叫相关操作
2719
- this.calls = {
2720
- 'requestCallStatus': function(fn) {
2721
- checkInit();
2722
- dispatch.calls.requestCallStatus(fn);
2723
- },
2724
- 'requestTelStatus': function(tel,fn) {
2725
- checkInit();
2726
- dispatch.calls.requestTelStatus(tel,fn);
2727
- },
2728
- 'requestCallIns': function(fn) {
2729
- checkInit();
2730
- dispatch.calls.requestCallIns(fn);
2731
- },
2732
- 'listStatus': function(resultCallback) {
2733
- checkInit();
2734
- dispatch.calls.listStatus(resultCallback);
2735
- },
2736
- 'listCallIn': function(resultCallback) {
2737
- checkInit();
2738
- dispatch.calls.listCallIn(resultCallback);
2739
- },
2740
- /** 呼叫 */
2741
- 'makeCall': function(tel, businessId) {
2742
- checkInit();
2743
- dispatch.calls.makeCall(tel, businessId);
2744
- },
2745
- /** 视频呼叫 */
2746
- 'makeVideoCall': function(tel, businessId) {
2747
- checkInit();
2748
- dispatch.calls.makeVideoCall(tel, businessId);
2749
- },
2750
- 'hungUp': function(tel) {
2751
- checkInit();
2752
- dispatch.calls.hungUp(tel);
2753
- },
2754
- 'answer': function(tel, businessId) {
2755
- checkInit();
2756
- dispatch.calls.answer(tel, businessId);
2757
- },
2758
- 'answerAll': function(tel) {
2759
- checkInit();
2760
- dispatch.calls.answerAll();
2761
- },
2762
- "rollCall": function(tels) {
2763
- checkInit();
2764
- dispatch.calls.rollCall(tels);
2765
- },
2766
- "stopRollCall": function() {
2767
- checkInit();
2768
- dispatch.calls.stopRollCall();
2769
- },
2770
- "groupTurn": function(tels, isOnce) {
2771
- checkInit();
2772
- dispatch.calls.groupTurn(tels, isOnce);
2773
- },
2774
- 'hold': function(tel) {
2775
- checkInit();
2776
- dispatch.calls.hold(tel);
2777
- },
2778
- 'unhold': function(tel) {
2779
- checkInit();
2780
- dispatch.calls.unhold(tel);
2781
- },
2782
- 'transfer': function(from,to, businessId) {
2783
- checkInit();
2784
- dispatch.calls.transfer(from,to, businessId);
2785
- },
2786
- 'retrieve': function(tel) {
2787
- checkInit();
2788
- dispatch.calls.retrieve(tel);
2789
- },
2790
- 'tripleMonitor': function(tel) {
2791
- checkInit();
2792
- dispatch.calls.tripleMonitor(tel);
2793
- },
2794
- 'tripleBreakin': function(tel) {
2795
- checkInit();
2796
- dispatch.calls.tripleBreakin(tel);
2797
- },
2798
- 'tripleHungup': function(tel) {
2799
- checkInit();
2800
- dispatch.calls.tripleHungup(tel);
2801
- },
2802
- 'callRecord': function(tel) {
2803
- checkInit();
2804
- dispatch.calls.callRecord(tel);
2805
- },
2806
- 'callRecordEnd': function(tel) {
2807
- checkInit();
2808
- dispatch.calls.callRecordEnd(tel);
2809
- },
2810
- 'groupCall': function(groupId,autoAnswer,allAudience) {
2811
- checkInit();
2812
- dispatch.calls.groupCall(groupId,autoAnswer,allAudience);
2813
- },
2814
- 'groupCancel': function(groupId) {
2815
- checkInit();
2816
- dispatch.calls.groupCancel(groupId);
2817
- },
2818
- 'selectCall': function(tels,autoAnswer,allAudience) {
2819
- checkInit();
2820
- dispatch.calls.selectCall(tels,autoAnswer,allAudience);
2821
- },
2822
- 'selectCancel': function() {
2823
- checkInit();
2824
- dispatch.calls.selectCancel();
2825
- },
2826
- 'groupSame' : function(memIds,autoAnswer,allAudience) {
2827
- checkInit();
2828
- dispatch.calls.groupSame(memIds,autoAnswer,allAudience);
2829
- },
2830
- 'groupNotify': function(groupId,files,type,times,notifyId) {
2831
- checkInit();
2832
- dispatch.calls.groupNotify(groupId,files,type,times,notifyId);
2833
- },
2834
- 'selectNotify': function(tels,files,type,times,notifyId,confirm) {
2835
- checkInit();
2836
- dispatch.calls.selectNotify(tels,files,type,times,notifyId,confirm);
2837
- },
2838
- 'makeCallSame': function(tels, meetId) {
2839
- checkInit();
2840
- dispatch.calls.makeCallSame(tels, meetId);
2841
- },
2842
- 'openVideo': function(callNumber,callId,businessId,avRecord) {
2843
- checkInit();
2844
- dispatch.calls.openVideo(callNumber,callId,businessId,avRecord);
2845
- },
2846
- 'closeVideo': function(callNumber) {
2847
- checkInit();
2848
- dispatch.calls.closeVideo(callNumber);
2849
- },
2850
- 'notifyRecordOP': function(tel, title, opType, filename) {
2851
- checkInit();
2852
- dispatch.calls.notifyRecordOP(tel, title, opType, filename);
2853
- }
2854
- };
2855
- // 会议相关操作
2856
- this.meets = {
2857
- 'requestMeets': function(fn) {
2858
- checkInit();
2859
- dispatch.meets.requestMeets(fn);
2860
- },
2861
- 'requestMeet': function(id, fn) {
2862
- checkInit();
2863
- dispatch.meets.requestMeet(id, fn);
2864
- },
2865
- 'requestMeetMembers': function(id,fn) {
2866
- checkInit();
2867
- dispatch.meets.requestMeetMembers(id,fn);
2868
- },
2869
- 'requestMeetMember': function(meetId,tel,fn) {
2870
- checkInit();
2871
- dispatch.meets.requestMeetMember(meetId,tel,fn);
2872
- },
2873
- 'listMeets': function(fn) {
2874
- checkInit();
2875
- dispatch.meets.listMeets(fn);
2876
- },
2877
- 'getMeet': function(id, fn) {
2878
- checkInit();
2879
- dispatch.meets.getMeet(id, fn);
2880
- },
2881
- 'createMeet': function(name,businessId,resultCallback) {
2882
- checkInit();
2883
- dispatch.meets.createMeet(name,businessId,resultCallback);
2884
- },
2885
- 'createMeetDetail': function(name, businessId, resultCallback, meetAccess, meetAttr, timeBegin,
2886
- timeEnd, passwdSpeaker, passwdAudience, meetMembers, defineAttr) {
2887
- checkInit();
2888
- dispatch.meets.createMeetDetail(name, businessId,resultCallback, meetAccess, meetAttr, timeBegin,
2889
- timeEnd, passwdSpeaker, passwdAudience, meetMembers, defineAttr);
2890
- },
2891
- 'editMeet': function(meetId, meetName, resultCallback, meetAccess, meetAttr, timeBegin,
2892
- timeEnd, passwdSpeaker, passwdAudience, meetMembers) {
2893
- checkInit();
2894
- dispatch.meets.editMeet(meetId, meetName, resultCallback, meetAccess, meetAttr, timeBegin,
2895
- timeEnd, passwdSpeaker, passwdAudience, meetMembers);
2896
- },
2897
- 'endMeet': function(id) {
2898
- checkInit();
2899
- dispatch.meets.endMeet(id);
2900
- },
2901
- 'destroyMeet': function(id) {
2902
- checkInit();
2903
- dispatch.meets.destroyMeet(id);
2904
- },
2905
- 'lock': function(id) {
2906
- checkInit();
2907
- dispatch.meets.lock(id);
2908
- },
2909
- 'unlock': function(id) {
2910
- checkInit();
2911
- dispatch.meets.unlock(id);
2912
- },
2913
- 'startRecord': function(id) {
2914
- checkInit();
2915
- dispatch.meets.startRecord(id);
2916
- },
2917
- 'stopRecord': function(id) {
2918
- checkInit();
2919
- dispatch.meets.stopRecord(id);
2920
- },
2921
- 'startPlayVoice': function(id) {
2922
- checkInit();
2923
- dispatch.meets.startPlayVoice(id);
2924
- },
2925
- 'stopPlayVoice': function(id) {
2926
- checkInit();
2927
- dispatch.meets.stopPlayVoice(id);
2928
- },
2929
- 'getMeetRecord': function(id, tel, fn) {
2930
- checkInit();
2931
- dispatch.meets.getMeetRecord(id, tel, fn);
2932
- },
2933
- 'joinMember': function(id, tel, businessId, level, autoAnswer) {
2934
- checkInit();
2935
- dispatch.meets.joinMember(id,tel,businessId,level,autoAnswer);
2936
- },
2937
- 'joinVideoMember': function(id, tel, businessId, level, autoAnswer) {
2938
- checkInit();
2939
- dispatch.meets.joinVideoMember(id,tel,businessId,level,autoAnswer);
2940
- },
2941
- 'changeMemberLevel': function(id, tel, level) {
2942
- checkInit();
2943
- dispatch.meets.changeMemberLevel(id,tel,level);
2944
- },
2945
- 'changeMemberToSpeaker': function(id, tel) {
2946
- checkInit();
2947
- dispatch.meets.changeMemberToSpeaker(id,tel);
2948
- },
2949
- 'changeMemberToAudience': function(id, tel) {
2950
- checkInit();
2951
- dispatch.meets.changeMemberToAudience(id,tel);
2952
- },
2953
- 'changeMemberToChairman': function(id, tel) {
2954
- checkInit();
2955
- dispatch.meets.changeMemberToChairman(id,tel);
2956
- },
2957
- 'kickMember': function(id, tel) {
2958
- checkInit();
2959
- dispatch.meets.kickMember(id, tel);
2960
- },
2961
- 'privateTalk': function(id, tel) {
2962
- checkInit();
2963
- dispatch.meets.privateTalk(id, tel);
2964
- },
2965
- 'backToMeet': function(id, tel) {
2966
- checkInit();
2967
- dispatch.meets.backToMeet(id, tel);
2968
- }
2969
- };
2970
- //对讲组相关操作
2971
- this.groupPoc = {
2972
- 'requestMemsStatus': function(fn) {
2973
- checkInit();
2974
- dispatch.groupPoc.requestMemsStatus(fn);
2975
- },
2976
- 'requestMemStatus': function(pocNo,fn) {
2977
- checkInit();
2978
- dispatch.groupPoc.requestMemStatus(pocNo,fn);
2979
- },
2980
- 'requestGroupsStatus': function(fn) {
2981
- checkInit();
2982
- dispatch.groupPoc.requestGroupsStatus(fn);
2983
- },
2984
- 'requestGroupStatus': function(groupNo,isTmp,fn) {
2985
- checkInit();
2986
- dispatch.groupPoc.requestGroupStatus(groupNo,isTmp,fn);
2987
- },
2988
- 'listMemStatus': function(fn) {
2989
- checkInit();
2990
- dispatch.groupPoc.listMemStatus(fn);
2991
- },
2992
- 'listGroupStatus': function(fn) {
2993
- checkInit();
2994
- dispatch.groupPoc.listGroupStatus(fn);
2995
- },
2996
- 'listTempPoc' : function(fn) {
2997
- checkInit();
2998
- dispatch.groupPoc.listTempPoc(fn);
2999
- },
3000
- 'listMemSos': function(fn) {
3001
- checkInit();
3002
- dispatch.groupPoc.listMemSos(fn);
3003
- },
3004
- 'listPhoneStatus': function(fn) {
3005
- checkInit();
3006
- dispatch.groupPoc.listPhoneStatus(fn);
3007
- },
3008
- 'delMemSos': function(pocNo, fn) {
3009
- checkInit();
3010
- dispatch.groupPoc.delMemSos(pocNo, fn);
3011
- },
3012
- 'listJoinGroupReq': function(fn) {
3013
- checkInit();
3014
- dispatch.groupPoc.listJoinGroupReq(fn);
3015
- },
3016
- 'getGroupStatus': function(groupNo,isTmp,resultCallback) {
3017
- checkInit();
3018
- dispatch.groupPoc.getGroupStatus(groupNo,isTmp,resultCallback);
3019
- },
3020
- 'getGroupMemOnlineNum':function(resultCallback){
3021
- checkInit();
3022
- dispatch.groupPoc.getGroupMemOnlineNum(resultCallback);
3023
- },
3024
- 'talkbackCall': function(callNumber,pocNo,groupId,groupNo,callType,resultCallback) {
3025
- checkInit();
3026
- dispatch.groupPoc.talkbackCall(callNumber,pocNo,groupId,groupNo,callType,resultCallback);
3027
- },
3028
- 'talkbackEnd': function(pocNo,groupNo) {
3029
- checkInit();
3030
- dispatch.groupPoc.talkbackEnd(pocNo,groupNo);
3031
- },
3032
- 'talkbackChange': function(pocNo,groupSwitchNo,resultCallback) {
3033
- checkInit();
3034
- dispatch.groupPoc.talkbackChange(pocNo,groupSwitchNo,resultCallback);
3035
- },
3036
- 'speakPower': function(pocNo,pocCmd,groupNo,resultCallback) {
3037
- checkInit();
3038
- dispatch.groupPoc.speakPower(pocNo,pocCmd,groupNo,resultCallback);
3039
- },
3040
- 'createPocGroup': function(groupJsonData, resultCallback) {
3041
- checkInit();
3042
- dispatch.groupPoc.createPocGroup(groupJsonData, resultCallback);
3043
- },
3044
- 'deleteGroup': function(groupId,resultCallback) {
3045
- checkInit();
3046
- dispatch.groupPoc.deleteGroup(groupId,resultCallback);
3047
- },
3048
- 'joinGroupMem': function(groupId,memId,resultCallback) {
3049
- checkInit();
3050
- dispatch.groupPoc.joinGroupMem(groupId,memId,resultCallback);
3051
- },
3052
- 'removeGroupMem': function(groupId, memIds,resultCallback) {
3053
- checkInit();
3054
- dispatch.groupPoc.removeGroupMem(groupId,memIds,resultCallback);
3055
- },
3056
- 'getPocGroups': function(resultCallback) {
3057
- checkInit();
3058
- dispatch.groupPoc.getPocGroups(resultCallback);
3059
- },
3060
- 'getPocGroupMem': function(id,resultCallback) {
3061
- checkInit();
3062
- dispatch.groupPoc.getPocGroupMem(id,resultCallback);
3063
- },
3064
- 'getDisPatchOperInfo': function(token,resultCallback){
3065
- checkInit();
3066
- dispatch.groupPoc.getDisPatchOperInfo(token,resultCallback);
3067
- },
3068
- 'creatTmpPoc' : function(resultCallback){
3069
- checkInit();
3070
- dispatch.groupPoc.creatTmpPoc(resultCallback);
3071
- },
3072
- 'leaveTmpPocMembers' : function(callNumber,groupNo,resultCallback) {
3073
- checkInit();
3074
- dispatch.groupPoc.leaveTmpPocMembers(callNumber,groupNo,resultCallback);
3075
- },
3076
- 'openCloudEye' : function(pocNo,resultCallback) {
3077
- checkInit();
3078
- dispatch.groupPoc.openCloudEye(pocNo,resultCallback);
3079
- },
3080
- 'closeCloudEye' : function(pocNo,resultCallback) {
3081
- checkInit();
3082
- dispatch.groupPoc.closeCloudEye(pocNo,resultCallback);
3083
- },
3084
- 'rejectJoinGroup': function(pocNo, groupNo, resultCallback) {
3085
- checkInit();
3086
- dispatch.groupPoc.rejectJoinGroup(pocNo, groupNo, resultCallback);
3087
- },
3088
- 'delJoinGroup': function(pocNo, groupNo, resultCallback) {
3089
- checkInit();
3090
- dispatch.groupPoc.delJoinGroup(pocNo, groupNo, resultCallback);
3091
- },
3092
- 'ctrlPocMems': function(pocMembers, groupNo, ctrlPPTCmd, resultCallback) {
3093
- checkInit();
3094
- dispatch.groupPoc.ctrlPocMems(pocMembers, groupNo, ctrlPPTCmd, resultCallback);
3095
- }
3096
- };
3097
- }
3098
-
3099
- // 常量定义
3100
- Dispatch.prototype.event_const = event_const;
3101
- DispatchSub.prototype.event_const = event_const;
3102
- DispatchProxy.prototype.event_const = event_const;
3103
- DispatchXDomain.prototype.event_const = event_const;
3104
- DispatchProxy.prototype.status_const = status_const;
3105
-
3106
- return window.scooper.dispatch = new DispatchProxy();
3107
- }));