@exotel-npm-dev/webrtc-client-sdk 1.0.18 → 1.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exotel-npm-dev/webrtc-client-sdk",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "client sdk for webrtc based on webrtc core sdk",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -7,7 +7,7 @@ var logger = webrtcSIPPhone.getLogger();
7
7
  * @param {*} sipAccountInfo
8
8
  * @param {*} exWebClient
9
9
  */
10
- export function DoRegister(sipAccountInfo, exWebClient) {
10
+ export function DoRegister(sipAccountInfo, exWebClient, delay = 500) {
11
11
  /**
12
12
  * When user registers the agent phone for the first time, register your callback onto webrtc client
13
13
  */
@@ -16,15 +16,14 @@ export function DoRegister(sipAccountInfo, exWebClient) {
16
16
  * CHANGE IS REQUIRED - in the initialize function provision is to be given to pass Callback functions as arguments
17
17
  */
18
18
  try {
19
- setTimeout(function() {
19
+ setTimeout(function () {
20
20
  exWebClient.initialize(userContext,
21
21
  sipAccountInfo.domain, //hostname
22
22
  sipAccountInfo.userName, //subscriberName
23
23
  sipAccountInfo.displayname,//displayName
24
24
  sipAccountInfo.accountSid,//accountSid
25
25
  '', sipAccountInfo); // subscriberToken
26
- }, 500);
27
-
26
+ }, delay);
28
27
  } catch (e) {
29
28
  logger.log("Register failed ", e)
30
29
  }
@@ -147,11 +147,18 @@ export function ExDelegationHandler(exClient_) {
147
147
 
148
148
  this.onRecieveInvite = function (incomingSession) {
149
149
  logger.log("delegationHandler: onRecieveInvite\n");
150
+ const obj = incomingSession.incomingInviteRequest.message.headers;
150
151
  exClient.callFromNumber = incomingSession.incomingInviteRequest.message.from.displayName;
151
- CallDetails.callSid = incomingSession.incomingInviteRequest.message.headers['X-Exotel-Callsid'][0].raw;
152
- CallDetails.callId = incomingSession.incomingInviteRequest.message.headers['Call-ID'][0].raw;
152
+ if (obj.hasOwnProperty("X-Exotel-Callsid")) {
153
+ CallDetails.callSid = obj['X-Exotel-Callsid'][0].raw;
154
+ }
155
+ if (obj.hasOwnProperty("Call-ID")) {
156
+ CallDetails.callId = obj['Call-ID'][0].raw;
157
+ }
158
+ if (obj.hasOwnProperty("LegSid")) {
159
+ CallDetails.legSid = obj['LegSid'][0].raw;
160
+ }
153
161
  const result = {};
154
- const obj = incomingSession.incomingInviteRequest.message.headers;
155
162
  for (let key in obj) {
156
163
  if (obj.hasOwnProperty(key)) {
157
164
  if (obj[key].length == 1) {
@@ -360,7 +367,7 @@ export class ExotelWebClient {
360
367
  }
361
368
  if (this.shouldAutoRetry) {
362
369
  logger.log("ExWebClient:registerEventCallback Autoretrying");
363
- DoRegisterRL(this.sipAccountInfo, this);
370
+ DoRegisterRL(this.sipAccountInfo, this, 5000);
364
371
  }
365
372
  } else if (event === "sent_request") {
366
373
  /**