podchat 12.2.0 → 12.3.0

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 CHANGED
@@ -5,6 +5,17 @@ to see complete list of changelog please visit [ChangeLog](https://github.com/ma
5
5
 
6
6
 
7
7
 
8
+ ## [12.2.0] - 23-1-2022
9
+ ### Added
10
+ - callId in END CALL events
11
+
12
+ ### Changed
13
+ - idType as string in invitees list for startCall and startGroupCall
14
+
15
+ ### Fixed
16
+ - fixed errors on newMessageHandler
17
+
18
+
8
19
  ## [11.4.0] - 11-12-2021
9
20
  ### Added
10
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podchat",
3
- "version": "12.2.0",
3
+ "version": "12.3.0",
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.2.0"
11
+ "version:release": "npm version 12.3.0"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
package/src/chat.js CHANGED
@@ -61,6 +61,7 @@
61
61
  var Utility = new ChatUtility();
62
62
 
63
63
  var asyncClient,
64
+ currentModuleInstance = this,
64
65
  peerId,
65
66
  oldPeerId,
66
67
  userInfo,
@@ -374,6 +375,7 @@
374
375
  },
375
376
  currentCallParams = {},
376
377
  currentCallId = null,
378
+ newCallId = null,
377
379
  callClientType = {
378
380
  WEB: 1,
379
381
  ANDROID: 2,
@@ -390,7 +392,8 @@
390
392
  callStopQueue = {
391
393
  callStarted: false,
392
394
  },
393
- callRequestTimeout = (typeof params.callRequestTimeout === 'number' && params.callRequestTimeout >= 0) ? params.callRequestTimeout : 10000;
395
+ callRequestTimeout = (typeof params.callRequestTimeout === 'number' && params.callRequestTimeout >= 0) ? params.callRequestTimeout : 10000,
396
+ callNoAnswerTimeout = params.callOptions && params.callOptions.callNoAnswerTimeout ? params.callOptions.callNoAnswerTimeout : 0;
394
397
 
395
398
 
396
399
  /*******************************************************
@@ -3166,6 +3169,19 @@
3166
3169
  result: messageContent
3167
3170
  });
3168
3171
 
3172
+ if (messageContent.callId > 0) {
3173
+ if(!currentCallId ) {
3174
+ currentCallId = messageContent.callId;
3175
+ }
3176
+ else
3177
+ newCallId = messageContent.callId;
3178
+ } else {
3179
+ fireEvent('callEvents', {
3180
+ type: 'PARTNER_RECEIVED_YOUR_CALL',
3181
+ result: messageContent
3182
+ });
3183
+ }
3184
+
3169
3185
  currentCallId = messageContent.callId;
3170
3186
 
3171
3187
  break;
@@ -3213,6 +3229,11 @@
3213
3229
  type: 'RECEIVE_CALL',
3214
3230
  result: messageContent
3215
3231
  });
3232
+ if(!currentCallId ) {
3233
+ currentCallId = messageContent.callId;
3234
+ }
3235
+ else
3236
+ newCallId = messageContent.callId;
3216
3237
  } else {
3217
3238
  fireEvent('callEvents', {
3218
3239
  type: 'PARTNER_RECEIVED_YOUR_CALL',
@@ -3220,7 +3241,7 @@
3220
3241
  });
3221
3242
  }
3222
3243
 
3223
- currentCallId = messageContent.callId;
3244
+ // currentCallId = messageContent.callId;
3224
3245
 
3225
3246
  break;
3226
3247
 
@@ -3326,12 +3347,19 @@
3326
3347
  messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
3327
3348
  }
3328
3349
 
3350
+ if (messageContent.callId > 0) {
3351
+ if(!currentCallId )
3352
+ currentCallId = messageContent.callId;
3353
+ else
3354
+ newCallId = messageContent.callId;
3355
+ }
3356
+
3329
3357
  fireEvent('callEvents', {
3330
3358
  type: 'RECEIVE_CALL',
3331
3359
  result: messageContent
3332
3360
  });
3333
3361
 
3334
- currentCallId = messageContent.callId;
3362
+ // currentCallId = messageContent.callId;
3335
3363
 
3336
3364
  break;
3337
3365
 
@@ -3460,8 +3488,12 @@
3460
3488
  type: 'CALL_SESSION_CREATED',
3461
3489
  result: messageContent
3462
3490
  });
3491
+ if(!currentCallId)
3492
+ currentCallId = messageContent.callId;
3493
+ else
3494
+ newCallId = messageContent.callId;
3463
3495
 
3464
- currentCallId = messageContent.callId;
3496
+ // currentCallId = messageContent.callId;
3465
3497
 
3466
3498
  break;
3467
3499
 
@@ -12451,6 +12483,23 @@
12451
12483
  callRequestController.callRequestReceived = true;
12452
12484
  callRequestController.callEstablishedInMySide = true;
12453
12485
 
12486
+ if(callNoAnswerTimeout) {
12487
+ //TODO: Remove timeout when call ends fast
12488
+ setTimeout( function(metaData) {
12489
+ //Reject the call if participant didn't answer
12490
+ if(!callStopQueue.callStarted ) {
12491
+ fireEvent("callEvents", {
12492
+ type: "CALL_NO_ANSWER_TIMEOUT",
12493
+ message: "Call request timed out, Participant(s) didn't answer",
12494
+ });
12495
+
12496
+ metaData.callInstance.rejectCall({
12497
+ callId: currentCallId
12498
+ });
12499
+ }
12500
+ }, callNoAnswerTimeout, {callInstance: currentModuleInstance});
12501
+ }
12502
+
12454
12503
  return sendMessage(startCallData, {
12455
12504
  onResult: function (result) {
12456
12505
  callback && callback(result);