@exotel-npm-dev/webrtc-client-sdk 1.0.13 → 1.0.14

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.13",
3
+ "version": "1.0.14",
4
4
  "description": "client sdk for webrtc based on webrtc core sdk",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,50 +11,52 @@ export var CallDetails = {
11
11
  callAnswerTime: '',
12
12
  callEndReason: '',
13
13
  sessionId: '',
14
+ callSid: '',
15
+ sipHeaders: {},
14
16
 
15
- setCallDetails: function (callId,remoteId,remoteDisplayName,callDirection,
16
- callState,callDuration, callStartedTime, callEstablishedTime, callEndedTime, callAnswerTime, callEndReason, sessionId) {
17
- this.callId = callId;
18
- this.remoteId = remoteId;
19
- this.remoteDisplayName = remoteDisplayName;
20
- this.callDirection = callDirection;
21
- this.callState = callState;
22
- this.callDuration = callDuration;
23
- this.callStartedTime = callStartedTime;
24
- this.callEstablishedTime = callEstablishedTime;
25
- this.callEndedTime = callEndedTime;
26
- this.callAnswerTime = callAnswerTime;
27
- this.callEndReason = callEndReason;
28
- this.sessionId = sessionId;
29
- },
30
- getCallId: function(){
17
+ setCallDetails: function (callId, remoteId, remoteDisplayName, callDirection,
18
+ callState, callDuration, callStartedTime, callEstablishedTime, callEndedTime, callAnswerTime, callEndReason, sessionId) {
19
+ this.callId = callId;
20
+ this.remoteId = remoteId;
21
+ this.remoteDisplayName = remoteDisplayName;
22
+ this.callDirection = callDirection;
23
+ this.callState = callState;
24
+ this.callDuration = callDuration;
25
+ this.callStartedTime = callStartedTime;
26
+ this.callEstablishedTime = callEstablishedTime;
27
+ this.callEndedTime = callEndedTime;
28
+ this.callAnswerTime = callAnswerTime;
29
+ this.callEndReason = callEndReason;
30
+ this.sessionId = sessionId;
31
+ },
32
+ getCallId: function () {
31
33
  return this.callId;
32
34
  },
33
- getRemoteId: function(){
34
- return this.remoteId;
35
+ getRemoteId: function () {
36
+ return this.remoteId;
35
37
  },
36
- getRemoteDisplayName: function() {
38
+ getRemoteDisplayName: function () {
37
39
  return this.remoteDisplayName;
38
40
  },
39
- getCallDirection: function() {
41
+ getCallDirection: function () {
40
42
  return this.callDirection;
41
43
  },
42
- getCallDuration: function() {
44
+ getCallDuration: function () {
43
45
  return this.callDuration;
44
46
  },
45
- getCallEstablishedTime: function() {
47
+ getCallEstablishedTime: function () {
46
48
  return this.callEstablishedTime;
47
49
  },
48
- getCallStartedTime: function() {
49
- return this.callStartedTime;
50
+ getCallStartedTime: function () {
51
+ return this.callStartedTime;
50
52
  },
51
- getCallEndedTime: function() {
53
+ getCallEndedTime: function () {
52
54
  return this.callEndedTime;
53
55
  },
54
- getSessionId: function() {
56
+ getSessionId: function () {
55
57
  return this.sessionId;
56
58
  },
57
- getCallDetails: function(){
59
+ getCallDetails: function () {
58
60
  let callDetailsObj = {
59
61
  callId: this.callId,
60
62
  remoteId: this.remoteId,
@@ -68,6 +70,8 @@ export var CallDetails = {
68
70
  callAnswerTime: this.callAnswerTime,
69
71
  callEndReason: this.callEndReason,
70
72
  sessionId: this.sessionId,
73
+ callSid: this.callSid,
74
+ sipHeaders: this.sipHeaders
71
75
  }
72
76
  return callDetailsObj;
73
77
  }
@@ -11,6 +11,7 @@ import { callbacks, registerCallback, sessionCallback } from '../listeners/Callb
11
11
  import { webrtcTroubleshooterEventBus } from "./Callback";
12
12
 
13
13
  import { webrtcSIPPhone } from '@exotel-npm-dev/webrtc-core-sdk';
14
+ import { CallDetails } from "../api/callAPI/CallDetails";
14
15
 
15
16
  var intervalId;
16
17
  var intervalIDMap = new Map();
@@ -147,6 +148,20 @@ export function ExDelegationHandler(exClient_) {
147
148
  this.onRecieveInvite = function (incomingSession) {
148
149
  logger.log("delegationHandler: onRecieveInvite\n");
149
150
  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;
153
+ const result = {};
154
+ const obj = incomingSession.incomingInviteRequest.message.headers;
155
+ for (let key in obj) {
156
+ if (obj.hasOwnProperty(key)) {
157
+ if (obj[key].length == 1) {
158
+ result[key] = obj[key][0].raw;
159
+ } else if (obj[key].length > 1) {
160
+ result[key] = obj[key].map(item => item.raw);
161
+ }
162
+ }
163
+ }
164
+ CallDetails.sipHeaders = result;
150
165
  }
151
166
 
152
167
  this.onPickCall = function () {