podchat 12.3.0 → 12.5.1
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.
- package/changelog.md +26 -0
- package/package.json +2 -2
- package/src/chat.js +335 -8
- package/config.js +0 -59
package/changelog.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
All notable changes to this project will be documented here.
|
|
4
4
|
to see complete list of changelog please visit [ChangeLog](https://github.com/masoudmanson/pod-chat/blob/master/changelog.md)
|
|
5
5
|
|
|
6
|
+
## [12.5.0] - 11-7-2022
|
|
7
|
+
### Added
|
|
8
|
+
- Global typeCode and typeCodeOwnerId
|
|
9
|
+
- event type: SWITCH_TO_GROUP_CALL_REQUEST , RECORD_CALL_STARTED
|
|
10
|
+
- callId to event type: CALL_STARTED
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Removed contentCount from hasNext calculation in getThreads and getHistory
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Bug in GET_CALLS_TO_JOIN
|
|
17
|
+
|
|
18
|
+
## [12.4.0] - 24-5-2022
|
|
19
|
+
### Added
|
|
20
|
+
- Parameter: threadInfo in startCall and startGroupCall
|
|
21
|
+
- Parameter: joinCall to acceptCall
|
|
22
|
+
- Parameter: threadId to getCallsList
|
|
23
|
+
- Method: getCallsToJoin
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- error on eventType that has no callback
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [12.3.0] - 26-4-2022
|
|
30
|
+
### Added
|
|
31
|
+
- callNoAnswerTimeout to SDK configs
|
|
6
32
|
|
|
7
33
|
|
|
8
34
|
## [12.2.0] - 23-1-2022
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podchat",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.5.1",
|
|
4
4
|
"description": "Javascript SDK to use POD's Chat Service",
|
|
5
5
|
"main": "./src/chat.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"publish:snapshot": "npm run version:snapshot && npm publish --tag snapshot",
|
|
9
9
|
"version:snapshot": "npm version prerelease --preid snapshot",
|
|
10
10
|
"publish:release": "npm run version:release && npm publish",
|
|
11
|
-
"version:release": "npm version 12.
|
|
11
|
+
"version:release": "npm version 12.5.1"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
package/src/chat.js
CHANGED
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
userInfo,
|
|
68
68
|
token = params.token,
|
|
69
69
|
generalTypeCode = params.typeCode || 'default',
|
|
70
|
+
typeCodeOwnerId = params.typeCodeOwnerId || null,
|
|
70
71
|
mapApiKey = params.mapApiKey || '8b77db18704aa646ee5aaea13e7370f4f88b9e8c',
|
|
71
72
|
deviceId,
|
|
72
73
|
isNode = Utility.isNode(),
|
|
@@ -196,8 +197,12 @@
|
|
|
196
197
|
DESTINATED_RECORD_CALL: 126,
|
|
197
198
|
ASSISTANT_CALL_STARTED: 127,
|
|
198
199
|
ASSISTANT_CALL_ENDED: 128,
|
|
200
|
+
GET_CALLS_TO_JOIN: 129,
|
|
199
201
|
EXPORT_CHAT: 152,
|
|
200
202
|
|
|
203
|
+
SWITCH_TO_GROUP_CALL_REQUEST: 221,
|
|
204
|
+
RECORD_CALL_STARTED: 222,
|
|
205
|
+
|
|
201
206
|
ERROR: 999
|
|
202
207
|
},
|
|
203
208
|
inviteeVOidTypes = {
|
|
@@ -395,7 +400,6 @@
|
|
|
395
400
|
callRequestTimeout = (typeof params.callRequestTimeout === 'number' && params.callRequestTimeout >= 0) ? params.callRequestTimeout : 10000,
|
|
396
401
|
callNoAnswerTimeout = params.callOptions && params.callOptions.callNoAnswerTimeout ? params.callOptions.callNoAnswerTimeout : 0;
|
|
397
402
|
|
|
398
|
-
|
|
399
403
|
/*******************************************************
|
|
400
404
|
* P R I V A T E M E T H O D S *
|
|
401
405
|
*******************************************************/
|
|
@@ -1522,10 +1526,14 @@
|
|
|
1522
1526
|
tokenIssuer: 1
|
|
1523
1527
|
};
|
|
1524
1528
|
|
|
1525
|
-
if (params.typeCode) {
|
|
1526
|
-
messageVO.typeCode = params.typeCode;
|
|
1527
|
-
} else if (generalTypeCode) {
|
|
1529
|
+
if (params.typeCode || generalTypeCode) {
|
|
1530
|
+
messageVO.typeCode = generalTypeCode;//params.typeCode;
|
|
1531
|
+
}/* else if (generalTypeCode) {
|
|
1528
1532
|
messageVO.typeCode = generalTypeCode;
|
|
1533
|
+
}*/
|
|
1534
|
+
|
|
1535
|
+
if(typeCodeOwnerId) {
|
|
1536
|
+
messageVO.ownerId = typeCodeOwnerId;
|
|
1529
1537
|
}
|
|
1530
1538
|
|
|
1531
1539
|
if (params.messageType) {
|
|
@@ -1825,6 +1833,10 @@
|
|
|
1825
1833
|
* @return {undefined}
|
|
1826
1834
|
*/
|
|
1827
1835
|
chatMessageHandler = function (chatMessage) {
|
|
1836
|
+
if(chatMessage.typeCode && chatMessage.typeCode !== generalTypeCode) {
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1828
1840
|
var threadId = chatMessage.subjectId,
|
|
1829
1841
|
type = chatMessage.type,
|
|
1830
1842
|
// TODO Check this again
|
|
@@ -3262,6 +3274,7 @@
|
|
|
3262
3274
|
messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
3263
3275
|
}
|
|
3264
3276
|
|
|
3277
|
+
messageContent.callId = threadId;
|
|
3265
3278
|
fireEvent('callEvents', {
|
|
3266
3279
|
type: 'CALL_STARTED',
|
|
3267
3280
|
result: messageContent
|
|
@@ -3600,6 +3613,52 @@
|
|
|
3600
3613
|
|
|
3601
3614
|
break;
|
|
3602
3615
|
|
|
3616
|
+
/**
|
|
3617
|
+
* Type 129 Get Calls To Join
|
|
3618
|
+
*/
|
|
3619
|
+
case chatMessageVOTypes.GET_CALLS_TO_JOIN:
|
|
3620
|
+
if (messagesCallbacks[uniqueId]) {
|
|
3621
|
+
messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
3622
|
+
}
|
|
3623
|
+
break;
|
|
3624
|
+
|
|
3625
|
+
/**
|
|
3626
|
+
* Type 152 Gives us a json to export for user
|
|
3627
|
+
*/
|
|
3628
|
+
case chatMessageVOTypes.EXPORT_CHAT:
|
|
3629
|
+
if (messagesCallbacks[uniqueId]) {
|
|
3630
|
+
messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount, uniqueId));
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3633
|
+
break;
|
|
3634
|
+
|
|
3635
|
+
|
|
3636
|
+
/**
|
|
3637
|
+
* Type 221 Event to tell us p2p call converted to a group call
|
|
3638
|
+
*/
|
|
3639
|
+
case chatMessageVOTypes.SWITCH_TO_GROUP_CALL_REQUEST:
|
|
3640
|
+
fireEvent('callEvents', {
|
|
3641
|
+
type: 'SWITCH_TO_GROUP_CALL',
|
|
3642
|
+
result: messageContent //contains: isGroup, callId, threadId
|
|
3643
|
+
});
|
|
3644
|
+
|
|
3645
|
+
break;
|
|
3646
|
+
|
|
3647
|
+
/**
|
|
3648
|
+
* Type 222 Call Recording Started
|
|
3649
|
+
*/
|
|
3650
|
+
case chatMessageVOTypes.RECORD_CALL_STARTED:
|
|
3651
|
+
if (messagesCallbacks[uniqueId]) {
|
|
3652
|
+
messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3655
|
+
fireEvent('callEvents', {
|
|
3656
|
+
type: 'CALL_RECORDING_STARTED',
|
|
3657
|
+
result: messageContent
|
|
3658
|
+
});
|
|
3659
|
+
|
|
3660
|
+
break;
|
|
3661
|
+
|
|
3603
3662
|
/**
|
|
3604
3663
|
* Type 999 All unknown errors
|
|
3605
3664
|
*/
|
|
@@ -4964,7 +5023,7 @@
|
|
|
4964
5023
|
resultData = {
|
|
4965
5024
|
threads: [],
|
|
4966
5025
|
contentCount: result.contentCount,
|
|
4967
|
-
hasNext: (offset + count < result.contentCount && messageLength > 0),
|
|
5026
|
+
hasNext: messageContent && !(messageLength < count),//(offset + count < result.contentCount && messageLength > 0),
|
|
4968
5027
|
nextOffset: offset + messageLength
|
|
4969
5028
|
},
|
|
4970
5029
|
threadData;
|
|
@@ -6248,8 +6307,7 @@
|
|
|
6248
6307
|
var resultData = {
|
|
6249
6308
|
history: history,
|
|
6250
6309
|
contentCount: result.contentCount,
|
|
6251
|
-
hasNext: (sendMessageParams.content.offset + sendMessageParams.content.count < result.contentCount &&
|
|
6252
|
-
messageLength > 0),
|
|
6310
|
+
hasNext: result.result && !(result.result.length < sendMessageParams.content.count),//(sendMessageParams.content.offset + sendMessageParams.content.count < result.contentCount &&messageLength > 0),
|
|
6253
6311
|
nextOffset: sendMessageParams.content.offset + messageLength
|
|
6254
6312
|
};
|
|
6255
6313
|
|
|
@@ -8213,7 +8271,8 @@
|
|
|
8213
8271
|
}
|
|
8214
8272
|
}
|
|
8215
8273
|
for (var id in eventCallbacks[eventName]) {
|
|
8216
|
-
eventCallbacks[eventName][id]
|
|
8274
|
+
if(eventCallbacks[eventName] && eventCallbacks[eventName][id])
|
|
8275
|
+
eventCallbacks[eventName][id](param);
|
|
8217
8276
|
}
|
|
8218
8277
|
},
|
|
8219
8278
|
|
|
@@ -10272,6 +10331,193 @@
|
|
|
10272
10331
|
});
|
|
10273
10332
|
};
|
|
10274
10333
|
|
|
10334
|
+
function requestExportChat(stackArr, wantedCount, stepCount, offset, sendData) {
|
|
10335
|
+
sendData.content.offset = offset;
|
|
10336
|
+
sendData.content.count = stepCount;
|
|
10337
|
+
return new Promise(function(resolve, reject){
|
|
10338
|
+
return sendMessage(sendData, {
|
|
10339
|
+
onResult: function (result) {
|
|
10340
|
+
|
|
10341
|
+
var returnData = {
|
|
10342
|
+
hasError: result.hasError,
|
|
10343
|
+
cache: false,
|
|
10344
|
+
errorMessage: result.errorMessage,
|
|
10345
|
+
errorCode: result.errorCode
|
|
10346
|
+
};
|
|
10347
|
+
|
|
10348
|
+
if (!returnData.hasError) {
|
|
10349
|
+
for(var i in result.result) {
|
|
10350
|
+
stackArr.push(result.result[i]);
|
|
10351
|
+
}
|
|
10352
|
+
|
|
10353
|
+
consoleLogging && console.log("[SDK][exportChat] a step passed...");
|
|
10354
|
+
wantedCount = wantedCount > result.contentCount ? result.contentCount : wantedCount;
|
|
10355
|
+
setTimeout(function () {
|
|
10356
|
+
fireEvent('threadEvents', {
|
|
10357
|
+
type: 'EXPORT_CHAT',
|
|
10358
|
+
subType: 'IN_PROGRESS',
|
|
10359
|
+
threadId: sendData.subjectId,
|
|
10360
|
+
percent: Math.floor((stackArr.length / wantedCount) * 100)
|
|
10361
|
+
});
|
|
10362
|
+
|
|
10363
|
+
if(stackArr.length < wantedCount) {
|
|
10364
|
+
stepCount = wantedCount - stackArr.length < stepCount ? wantedCount - stackArr.length : stepCount;
|
|
10365
|
+
//setTimeout(function () {
|
|
10366
|
+
resolve(requestExportChat(stackArr, wantedCount, stepCount, stackArr.length, sendData));
|
|
10367
|
+
//}, 1000)
|
|
10368
|
+
} else {
|
|
10369
|
+
resolve(stackArr);
|
|
10370
|
+
}
|
|
10371
|
+
});
|
|
10372
|
+
} else {
|
|
10373
|
+
if(result.errorCode !== 21) {
|
|
10374
|
+
consoleLogging && console.log("[SDK][exportChat] Problem in one step... . Rerunning the request.", wantedCount, stepCount, stackArr.length, sendData, result);
|
|
10375
|
+
setTimeout(function () {
|
|
10376
|
+
resolve(requestExportChat(stackArr, wantedCount, stepCount, stackArr.length, sendData))
|
|
10377
|
+
}, 2000)
|
|
10378
|
+
} else {
|
|
10379
|
+
reject(result)
|
|
10380
|
+
}
|
|
10381
|
+
}
|
|
10382
|
+
}
|
|
10383
|
+
});
|
|
10384
|
+
})
|
|
10385
|
+
}
|
|
10386
|
+
|
|
10387
|
+
this.exportChat = function (params, callback) {
|
|
10388
|
+
var stackArr = [], wantedCount = 10000, stepCount = 500, offset = 0;
|
|
10389
|
+
var sendData = {
|
|
10390
|
+
chatMessageVOType: chatMessageVOTypes.EXPORT_CHAT,
|
|
10391
|
+
typeCode: generalTypeCode,//params.typeCode,
|
|
10392
|
+
content: {
|
|
10393
|
+
offset: +params.offset > 0 ? +params.offset : offset,
|
|
10394
|
+
count: +params.count > 0 ? +params.count : wantedCount,//config.getHistoryCount,
|
|
10395
|
+
},
|
|
10396
|
+
subjectId: params.threadId
|
|
10397
|
+
};
|
|
10398
|
+
|
|
10399
|
+
if (+params.fromTime > 0 && +params.fromTime < 9999999999999) {
|
|
10400
|
+
sendData.content.fromTime = +params.fromTime;
|
|
10401
|
+
}
|
|
10402
|
+
|
|
10403
|
+
if (+params.toTime > 0 && +params.toTime < 9999999999999) {
|
|
10404
|
+
sendData.content.toTime = +params.toTime;
|
|
10405
|
+
}
|
|
10406
|
+
|
|
10407
|
+
if(+params.wantedCount > 0) {
|
|
10408
|
+
wantedCount = params.wantedCount;
|
|
10409
|
+
}
|
|
10410
|
+
|
|
10411
|
+
if(+params.stepCount > 0) {
|
|
10412
|
+
stepCount = params.stepCount;
|
|
10413
|
+
}
|
|
10414
|
+
|
|
10415
|
+
if(+params.offset > 0) {
|
|
10416
|
+
offset = params.offset;
|
|
10417
|
+
}
|
|
10418
|
+
|
|
10419
|
+
// if (params.messageType && typeof params.messageType.toUpperCase() !== 'undefined' && chatMessageTypes[params.messageType.toUpperCase()] > 0) {
|
|
10420
|
+
// sendData.content.messageType = chatMessageTypes[params.messageType.toUpperCase()];
|
|
10421
|
+
// }
|
|
10422
|
+
sendData.content.messageType = 1;
|
|
10423
|
+
|
|
10424
|
+
if(wantedCount < stepCount)
|
|
10425
|
+
stepCount = wantedCount;
|
|
10426
|
+
|
|
10427
|
+
consoleLogging && console.log("[SDK][exportChat] Starting...");
|
|
10428
|
+
requestExportChat(stackArr, wantedCount, stepCount, offset, sendData).then(function (resultArray) {
|
|
10429
|
+
consoleLogging && console.log("[SDK][exportChat] Export done..., Now converting...");
|
|
10430
|
+
|
|
10431
|
+
if(!params.exportPath) {
|
|
10432
|
+
callback && callback({
|
|
10433
|
+
hasError: false,
|
|
10434
|
+
result: resultArray
|
|
10435
|
+
});
|
|
10436
|
+
fireEvent('threadEvents', {
|
|
10437
|
+
type: 'EXPORT_CHAT',
|
|
10438
|
+
subType: 'DONE',
|
|
10439
|
+
threadId: sendData.subjectId,
|
|
10440
|
+
result: resultArray
|
|
10441
|
+
});
|
|
10442
|
+
|
|
10443
|
+
return;
|
|
10444
|
+
}
|
|
10445
|
+
|
|
10446
|
+
var str = ''
|
|
10447
|
+
, universalBOM = "\uFEFF";
|
|
10448
|
+
|
|
10449
|
+
str += "\u{62A}\u{627}\u{631}\u{6CC}\u{62E} " + ','; //tarikh
|
|
10450
|
+
str += " \u{633}\u{627}\u{639}\u{62A} " + ','; //saat
|
|
10451
|
+
str += "\u{646}\u{627}\u{645} \u{641}\u{631}\u{633}\u{62A}\u{646}\u{62F}\u{647}" + ',';//name ferestande
|
|
10452
|
+
str += "\u{646}\u{627}\u{645} \u{6A9}\u{627}\u{631}\u{628}\u{631}\u{6CC} \u{641}\u{631}\u{633}\u{62A}\u{646}\u{62F}\u{647}" + ','; //name karbariye ferestande
|
|
10453
|
+
str += "\u{645}\u{62A}\u{646} \u{67E}\u{6CC}\u{627}\u{645}" + ',';//matne payam
|
|
10454
|
+
str += '\r\n';
|
|
10455
|
+
var line = '', radif = 1;
|
|
10456
|
+
for (var i = 0; i < resultArray.length; i++) {
|
|
10457
|
+
line = '';
|
|
10458
|
+
|
|
10459
|
+
if(resultArray[i].messageType !== 1) {
|
|
10460
|
+
continue;
|
|
10461
|
+
}
|
|
10462
|
+
|
|
10463
|
+
var sender = '';
|
|
10464
|
+
if(resultArray[i].participant.contactName) {
|
|
10465
|
+
sender = resultArray[i].participant.contactName + ',';
|
|
10466
|
+
} else {
|
|
10467
|
+
if(resultArray[i].participant.firstName) {
|
|
10468
|
+
sender = resultArray[i].participant.firstName + ' ';
|
|
10469
|
+
}
|
|
10470
|
+
if(resultArray[i].participant.lastName) {
|
|
10471
|
+
sender += resultArray[i].participant.lastName;
|
|
10472
|
+
}
|
|
10473
|
+
sender += ','
|
|
10474
|
+
}
|
|
10475
|
+
|
|
10476
|
+
line += new Date(resultArray[i].time).toLocaleDateString('fa-IR') + ',';
|
|
10477
|
+
line += new Date(resultArray[i].time).toLocaleTimeString('fa-IR') + ',';
|
|
10478
|
+
line += sender;
|
|
10479
|
+
line += resultArray[i].participant.username + ',';
|
|
10480
|
+
line += '"' + resultArray[i].message.replace(/,/g, "،").replace(/"/g, '”') + '",';
|
|
10481
|
+
// line += result[i].message.replaceAll(",", ".").replace(/(\r\n|\n|\r)/gm, " ") + ',';
|
|
10482
|
+
str += line + '\r\n';
|
|
10483
|
+
radif++;
|
|
10484
|
+
}
|
|
10485
|
+
|
|
10486
|
+
|
|
10487
|
+
FS.writeFile(params.exportPath, universalBOM + str, {encoding: 'utf8'}, function (err) {
|
|
10488
|
+
if (err){
|
|
10489
|
+
fireEvent('ERROR', {
|
|
10490
|
+
code: null,
|
|
10491
|
+
message: err
|
|
10492
|
+
});
|
|
10493
|
+
callback && callback({
|
|
10494
|
+
hasError: true,
|
|
10495
|
+
code: null,
|
|
10496
|
+
message: err
|
|
10497
|
+
});
|
|
10498
|
+
}
|
|
10499
|
+
|
|
10500
|
+
callback && callback({
|
|
10501
|
+
hasError: false,
|
|
10502
|
+
result: resultArray,
|
|
10503
|
+
exportPath: params.exportPath
|
|
10504
|
+
});
|
|
10505
|
+
|
|
10506
|
+
fireEvent('threadEvents', {
|
|
10507
|
+
type: 'EXPORT_CHAT',
|
|
10508
|
+
subType: 'EXPORTED_TO_DIRECTORY',
|
|
10509
|
+
threadId: sendData.subjectId,
|
|
10510
|
+
exportPath: params.exportPath,
|
|
10511
|
+
result: resultArray
|
|
10512
|
+
});
|
|
10513
|
+
|
|
10514
|
+
|
|
10515
|
+
});
|
|
10516
|
+
|
|
10517
|
+
callback = undefined;
|
|
10518
|
+
})
|
|
10519
|
+
}
|
|
10520
|
+
|
|
10275
10521
|
this.getImage = getImage;
|
|
10276
10522
|
|
|
10277
10523
|
this.getFile = getFile;
|
|
@@ -12471,6 +12717,13 @@
|
|
|
12471
12717
|
}
|
|
12472
12718
|
}
|
|
12473
12719
|
|
|
12720
|
+
if(params.threadInfo
|
|
12721
|
+
&& (params.threadInfo.metadata
|
|
12722
|
+
|| params.threadInfo.uniqueName)
|
|
12723
|
+
) {
|
|
12724
|
+
content.createCallThreadRequest = params.threadInfo
|
|
12725
|
+
}
|
|
12726
|
+
|
|
12474
12727
|
startCallData.content = JSON.stringify(content);
|
|
12475
12728
|
} else {
|
|
12476
12729
|
fireEvent('error', {
|
|
@@ -12556,6 +12809,15 @@
|
|
|
12556
12809
|
}
|
|
12557
12810
|
}
|
|
12558
12811
|
|
|
12812
|
+
if(params.threadInfo
|
|
12813
|
+
&& (params.threadInfo.title
|
|
12814
|
+
|| params.threadInfo.description
|
|
12815
|
+
|| params.threadInfo.metadata
|
|
12816
|
+
|| params.threadInfo.uniqueName)
|
|
12817
|
+
) {
|
|
12818
|
+
content.createCallThreadRequest = params.threadInfo
|
|
12819
|
+
}
|
|
12820
|
+
|
|
12559
12821
|
startCallData.content = JSON.stringify(content);
|
|
12560
12822
|
} else {
|
|
12561
12823
|
fireEvent('error', {
|
|
@@ -12644,6 +12906,11 @@
|
|
|
12644
12906
|
}
|
|
12645
12907
|
|
|
12646
12908
|
acceptCallData.content = JSON.stringify(content);
|
|
12909
|
+
|
|
12910
|
+
if(params.joinCall) {
|
|
12911
|
+
callRequestController.callRequestReceived = true;
|
|
12912
|
+
currentCallId = params.callId;
|
|
12913
|
+
}
|
|
12647
12914
|
} else {
|
|
12648
12915
|
fireEvent('error', {
|
|
12649
12916
|
code: 999,
|
|
@@ -12735,6 +13002,10 @@
|
|
|
12735
13002
|
content.callIds = params.callIds;
|
|
12736
13003
|
}
|
|
12737
13004
|
|
|
13005
|
+
if (typeof params.threadId === 'number' && +params.threadId > 0) {
|
|
13006
|
+
content.threadId = +params.threadId;
|
|
13007
|
+
}
|
|
13008
|
+
|
|
12738
13009
|
if (typeof params.contactType === 'string') {
|
|
12739
13010
|
content.contactType = params.contactType;
|
|
12740
13011
|
}
|
|
@@ -12759,6 +13030,62 @@
|
|
|
12759
13030
|
});
|
|
12760
13031
|
};
|
|
12761
13032
|
|
|
13033
|
+
this.getCallsToJoin = function (params, callback) {
|
|
13034
|
+
var getCallListData = {
|
|
13035
|
+
chatMessageVOType: chatMessageVOTypes.GET_CALLS_TO_JOIN,
|
|
13036
|
+
pushMsgType: 3,
|
|
13037
|
+
token: token
|
|
13038
|
+
}, content = {};
|
|
13039
|
+
|
|
13040
|
+
if (params) {
|
|
13041
|
+
if (typeof params.count === 'number' && params.count >= 0) {
|
|
13042
|
+
content.count = +params.count;
|
|
13043
|
+
} else {
|
|
13044
|
+
content.count = 50;
|
|
13045
|
+
}
|
|
13046
|
+
|
|
13047
|
+
if (typeof params.offset === 'number' && params.offset >= 0) {
|
|
13048
|
+
content.offset = +params.offset;
|
|
13049
|
+
} else {
|
|
13050
|
+
content.offset = 0;
|
|
13051
|
+
}
|
|
13052
|
+
|
|
13053
|
+
if (typeof params.creatorSsoId === 'number' && params.creatorSsoId > 0) {
|
|
13054
|
+
content.creatorSsoId = +params.creatorSsoId;
|
|
13055
|
+
}
|
|
13056
|
+
|
|
13057
|
+
if (typeof params.name === 'string') {
|
|
13058
|
+
content.name = params.name;
|
|
13059
|
+
}
|
|
13060
|
+
|
|
13061
|
+
if (typeof params.type === 'string' && callTypes.hasOwnProperty(params.type.toUpperCase())) {
|
|
13062
|
+
content.type = callTypes[params.type.toUpperCase()];
|
|
13063
|
+
}
|
|
13064
|
+
|
|
13065
|
+
if (Array.isArray(params.threadIds)) {
|
|
13066
|
+
content.threadIds = params.threadIds;
|
|
13067
|
+
}
|
|
13068
|
+
|
|
13069
|
+
if (typeof params.uniqueId === 'string') {
|
|
13070
|
+
content.uniqueId = params.uniqueId;
|
|
13071
|
+
}
|
|
13072
|
+
|
|
13073
|
+
getCallListData.content = JSON.stringify(content);
|
|
13074
|
+
} else {
|
|
13075
|
+
fireEvent('error', {
|
|
13076
|
+
code: 999,
|
|
13077
|
+
message: 'Invalid params'
|
|
13078
|
+
});
|
|
13079
|
+
return;
|
|
13080
|
+
}
|
|
13081
|
+
|
|
13082
|
+
return sendMessage(getCallListData, {
|
|
13083
|
+
onResult: function (result) {
|
|
13084
|
+
callback && callback(result);
|
|
13085
|
+
}
|
|
13086
|
+
});
|
|
13087
|
+
};
|
|
13088
|
+
|
|
12762
13089
|
this.getCallParticipants = function (params, callback) {
|
|
12763
13090
|
var sendMessageParams = {
|
|
12764
13091
|
chatMessageVOType: chatMessageVOTypes.ACTIVE_CALL_PARTICIPANTS,
|
package/config.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var CONFIG = {
|
|
2
|
-
// token: '1cfce37b60d4421db870e67dcfe407d9', // gameBOT
|
|
3
|
-
// token: '567179f126d84277b8dced22599e0b82', // takiBOT
|
|
4
|
-
// token: '1a9d91ccb4d5431b89dd74f7e0bb417b', // talkyBOT
|
|
5
|
-
// token: 'd10237d19ad24ba089f66bdfe3de9974', // Clasor
|
|
6
|
-
// token: "b135febd870746f88032df84dfb01c85", // Clasor Test BOT
|
|
7
|
-
token: 'b45fa3d386f54e34b82d81a11bc27e90',
|
|
8
|
-
|
|
9
|
-
// Permenant Integration Tokens
|
|
10
|
-
// token: "3dd6895c8dc64f93bcd43b58dcc2aab3", // Masoud Amjadi
|
|
11
|
-
// token: "9c627a9125d04ebf8455bf57bb33d2a9", // Pooria Pahlevani
|
|
12
|
-
// token: "f6464d4e0f044314b1a668f90287ba26", // Nadia Anvari
|
|
13
|
-
// token: "99506f7c32c849a9a6e2a954303b81ee", // Farhad Kheirkhah
|
|
14
|
-
// token: "979aa5de03934c73a5c6c855bd80cb04", // Mahyar Zhiani
|
|
15
|
-
// token: "a47c9016c8354236abc01395093bed5c", // Ahmad Sajadi
|
|
16
|
-
// token: "d3114ed2fd2a49b4a0a386e727c9e5fa", // Saba Safavi
|
|
17
|
-
// token: "872110b9c6944eda9bc98ef2a68dcf50", // Leila Nemati
|
|
18
|
-
|
|
19
|
-
// ActiveMQ Connection config
|
|
20
|
-
// queueHost: "10.56.16.25",
|
|
21
|
-
// queuePort: "61613",
|
|
22
|
-
// queueUsername: "root",
|
|
23
|
-
// queuePassword: "zalzalak",
|
|
24
|
-
// queueReceive: "queue-in-amjadi-stomp",
|
|
25
|
-
// queueSend: "queue-out-amjadi-stomp",
|
|
26
|
-
|
|
27
|
-
// Neshan Map Api Token
|
|
28
|
-
mapApiKey: '8b77db18704aa646ee5aaea13e7370f4f88b9e8c',
|
|
29
|
-
|
|
30
|
-
// Main Server
|
|
31
|
-
main: {
|
|
32
|
-
socketAddress: 'wss://msg.pod.ir/ws',
|
|
33
|
-
ssoHost: 'https://accounts.pod.ir',
|
|
34
|
-
platformHost: 'https://api.pod.ir/srv/core',
|
|
35
|
-
fileServer: 'https://core.pod.ir',
|
|
36
|
-
podSpaceFileServer: 'https://podspace.podland.ir',
|
|
37
|
-
serverName: 'chat-server'
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
// Sand Box Server
|
|
41
|
-
sandbox: {
|
|
42
|
-
socketAddress: "wss://chat-sandbox.pod.ir/ws",
|
|
43
|
-
ssoHost: "https://accounts.pod.ir",
|
|
44
|
-
platformHost: "https://sandbox.pod.ir:8043/srv/basic-platform",
|
|
45
|
-
fileServer: 'https://core.pod.ir',
|
|
46
|
-
podSpaceFileServer: 'http://sandbox.podspace.ir:8080',
|
|
47
|
-
serverName: "chat-server"
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
// Integration Server
|
|
51
|
-
integration: {
|
|
52
|
-
socketAddress: "ws://172.16.110.235:8003/ws",
|
|
53
|
-
ssoHost: "http://172.16.110.76",
|
|
54
|
-
platformHost: "http://172.16.110.235:8003/srv/bptest-core",
|
|
55
|
-
fileServer: 'https://core.pod.ir',
|
|
56
|
-
podSpaceFileServer: 'http://172.16.110.61:8780/podspace',
|
|
57
|
-
serverName: "chatlocal"
|
|
58
|
-
}
|
|
59
|
-
}
|