@webex/calling 0.0.1-next.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/README.md +67 -0
- package/dist/module/CallHistory/CallHistory.js +84 -0
- package/dist/module/CallHistory/callHistoryFixtures.js +307 -0
- package/dist/module/CallHistory/constants.js +9 -0
- package/dist/module/CallHistory/types.js +1 -0
- package/dist/module/CallSettings/CallSettings.js +65 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +100 -0
- package/dist/module/CallSettings/WxCallBackendConnector.js +287 -0
- package/dist/module/CallSettings/constants.js +11 -0
- package/dist/module/CallSettings/testFixtures.js +62 -0
- package/dist/module/CallSettings/types.js +1 -0
- package/dist/module/CallingClient/CallingClient.js +268 -0
- package/dist/module/CallingClient/callRecordFixtures.js +93 -0
- package/dist/module/CallingClient/calling/CallerId/index.js +169 -0
- package/dist/module/CallingClient/calling/CallerId/types.js +1 -0
- package/dist/module/CallingClient/calling/call.js +1649 -0
- package/dist/module/CallingClient/calling/callManager.js +274 -0
- package/dist/module/CallingClient/calling/index.js +2 -0
- package/dist/module/CallingClient/calling/types.js +53 -0
- package/dist/module/CallingClient/callingClientFixtures.js +38 -0
- package/dist/module/CallingClient/constants.js +122 -0
- package/dist/module/CallingClient/line/index.js +110 -0
- package/dist/module/CallingClient/line/types.js +14 -0
- package/dist/module/CallingClient/registration/index.js +1 -0
- package/dist/module/CallingClient/registration/register.js +507 -0
- package/dist/module/CallingClient/registration/registerFixtures.js +28 -0
- package/dist/module/CallingClient/registration/types.js +1 -0
- package/dist/module/CallingClient/types.js +1 -0
- package/dist/module/Contacts/ContactsClient.js +487 -0
- package/dist/module/Contacts/constants.js +20 -0
- package/dist/module/Contacts/contactFixtures.js +284 -0
- package/dist/module/Contacts/types.js +10 -0
- package/dist/module/Errors/catalog/CallError.js +26 -0
- package/dist/module/Errors/catalog/CallingDeviceError.js +18 -0
- package/dist/module/Errors/catalog/ExtendedError.js +10 -0
- package/dist/module/Errors/catalog/LineError.js +24 -0
- package/dist/module/Errors/index.js +2 -0
- package/dist/module/Errors/types.js +48 -0
- package/dist/module/Events/impl/index.js +19 -0
- package/dist/module/Events/types.js +74 -0
- package/dist/module/Logger/index.js +114 -0
- package/dist/module/Logger/types.js +25 -0
- package/dist/module/Metrics/index.js +232 -0
- package/dist/module/Metrics/types.js +37 -0
- package/dist/module/SDKConnector/index.js +39 -0
- package/dist/module/SDKConnector/types.js +1 -0
- package/dist/module/SDKConnector/utils.js +12 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +289 -0
- package/dist/module/Voicemail/UcmBackendConnector.js +275 -0
- package/dist/module/Voicemail/Voicemail.js +110 -0
- package/dist/module/Voicemail/WxCallBackendConnector.js +279 -0
- package/dist/module/Voicemail/constants.js +29 -0
- package/dist/module/Voicemail/types.js +1 -0
- package/dist/module/Voicemail/voicemailFixture.js +449 -0
- package/dist/module/common/Utils.js +802 -0
- package/dist/module/common/constants.js +40 -0
- package/dist/module/common/index.js +1 -0
- package/dist/module/common/testUtil.js +938 -0
- package/dist/module/common/types.js +57 -0
- package/dist/module/index.js +8 -0
- package/dist/types/CallHistory/CallHistory.d.ts +19 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -0
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +95 -0
- package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -0
- package/dist/types/CallHistory/constants.d.ts +10 -0
- package/dist/types/CallHistory/constants.d.ts.map +1 -0
- package/dist/types/CallHistory/types.d.ts +21 -0
- package/dist/types/CallHistory/types.d.ts.map +1 -0
- package/dist/types/CallSettings/CallSettings.d.ts +20 -0
- package/dist/types/CallSettings/CallSettings.d.ts.map +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +20 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -0
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts +22 -0
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -0
- package/dist/types/CallSettings/constants.d.ts +12 -0
- package/dist/types/CallSettings/constants.d.ts.map +1 -0
- package/dist/types/CallSettings/testFixtures.d.ts +16 -0
- package/dist/types/CallSettings/testFixtures.d.ts.map +1 -0
- package/dist/types/CallSettings/types.d.ts +108 -0
- package/dist/types/CallSettings/types.d.ts.map +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts +38 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -0
- package/dist/types/CallingClient/callRecordFixtures.d.ts +4 -0
- package/dist/types/CallingClient/callRecordFixtures.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/CallerId/index.d.ts +18 -0
- package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/CallerId/types.d.ts +42 -0
- package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/call.d.ts +95 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/callManager.d.ts +22 -0
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/index.d.ts +3 -0
- package/dist/types/CallingClient/calling/index.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/types.d.ts +204 -0
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -0
- package/dist/types/CallingClient/callingClientFixtures.d.ts +19 -0
- package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -0
- package/dist/types/CallingClient/constants.d.ts +123 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -0
- package/dist/types/CallingClient/line/index.d.ts +39 -0
- package/dist/types/CallingClient/line/index.d.ts.map +1 -0
- package/dist/types/CallingClient/line/types.d.ts +51 -0
- package/dist/types/CallingClient/line/types.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/index.d.ts +2 -0
- package/dist/types/CallingClient/registration/index.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/register.d.ts +65 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/registerFixtures.d.ts +29 -0
- package/dist/types/CallingClient/registration/registerFixtures.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/types.d.ts +21 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -0
- package/dist/types/CallingClient/types.d.ts +30 -0
- package/dist/types/CallingClient/types.d.ts.map +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts +28 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -0
- package/dist/types/Contacts/constants.d.ts +20 -0
- package/dist/types/Contacts/constants.d.ts.map +1 -0
- package/dist/types/Contacts/contactFixtures.d.ts +281 -0
- package/dist/types/Contacts/contactFixtures.d.ts.map +1 -0
- package/dist/types/Contacts/types.d.ts +75 -0
- package/dist/types/Contacts/types.d.ts.map +1 -0
- package/dist/types/Errors/catalog/CallError.d.ts +12 -0
- package/dist/types/Errors/catalog/CallError.d.ts.map +1 -0
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +11 -0
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -0
- package/dist/types/Errors/catalog/ExtendedError.d.ts +7 -0
- package/dist/types/Errors/catalog/ExtendedError.d.ts.map +1 -0
- package/dist/types/Errors/catalog/LineError.d.ts +11 -0
- package/dist/types/Errors/catalog/LineError.d.ts.map +1 -0
- package/dist/types/Errors/index.d.ts +3 -0
- package/dist/types/Errors/index.d.ts.map +1 -0
- package/dist/types/Errors/types.d.ts +61 -0
- package/dist/types/Errors/types.d.ts.map +1 -0
- package/dist/types/Events/impl/index.d.ts +9 -0
- package/dist/types/Events/impl/index.d.ts.map +1 -0
- package/dist/types/Events/types.d.ts +284 -0
- package/dist/types/Events/types.d.ts.map +1 -0
- package/dist/types/Logger/index.d.ts +13 -0
- package/dist/types/Logger/index.d.ts.map +1 -0
- package/dist/types/Logger/types.d.ts +26 -0
- package/dist/types/Logger/types.d.ts.map +1 -0
- package/dist/types/Metrics/index.d.ts +6 -0
- package/dist/types/Metrics/index.d.ts.map +1 -0
- package/dist/types/Metrics/types.d.ts +43 -0
- package/dist/types/Metrics/types.d.ts.map +1 -0
- package/dist/types/SDKConnector/index.d.ts +13 -0
- package/dist/types/SDKConnector/index.d.ts.map +1 -0
- package/dist/types/SDKConnector/types.d.ts +129 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -0
- package/dist/types/SDKConnector/utils.d.ts +6 -0
- package/dist/types/SDKConnector/utils.d.ts.map +1 -0
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts +28 -0
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -0
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +35 -0
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -0
- package/dist/types/Voicemail/Voicemail.d.ts +28 -0
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -0
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +24 -0
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -0
- package/dist/types/Voicemail/constants.d.ts +30 -0
- package/dist/types/Voicemail/constants.d.ts.map +1 -0
- package/dist/types/Voicemail/types.d.ts +134 -0
- package/dist/types/Voicemail/types.d.ts.map +1 -0
- package/dist/types/Voicemail/voicemailFixture.d.ts +350 -0
- package/dist/types/Voicemail/voicemailFixture.d.ts.map +1 -0
- package/dist/types/common/Utils.d.ts +35 -0
- package/dist/types/common/Utils.d.ts.map +1 -0
- package/dist/types/common/constants.d.ts +41 -0
- package/dist/types/common/constants.d.ts.map +1 -0
- package/dist/types/common/index.d.ts +2 -0
- package/dist/types/common/index.d.ts.map +1 -0
- package/dist/types/common/testUtil.d.ts +3612 -0
- package/dist/types/common/testUtil.d.ts.map +1 -0
- package/dist/types/common/types.d.ts +192 -0
- package/dist/types/common/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +161 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { CALL_MANAGER_FILE } from '../constants';
|
|
2
|
+
import { EVENT_KEYS } from '../../Events/types';
|
|
3
|
+
import { Eventing } from '../../Events/impl';
|
|
4
|
+
import SDKConnector from '../../SDKConnector';
|
|
5
|
+
import { CallDirection } from '../../common/types';
|
|
6
|
+
import { MediaState, MobiusEventType, } from './types';
|
|
7
|
+
import { createCall } from './call';
|
|
8
|
+
import log from '../../Logger';
|
|
9
|
+
let callManager;
|
|
10
|
+
export class CallManager extends Eventing {
|
|
11
|
+
sdkConnector;
|
|
12
|
+
webex;
|
|
13
|
+
callCollection;
|
|
14
|
+
activeMobiusUrl;
|
|
15
|
+
serviceIndicator;
|
|
16
|
+
constructor(webex, indicator) {
|
|
17
|
+
super();
|
|
18
|
+
this.sdkConnector = SDKConnector;
|
|
19
|
+
this.serviceIndicator = indicator;
|
|
20
|
+
if (!this.sdkConnector.getWebex()) {
|
|
21
|
+
SDKConnector.setWebex(webex);
|
|
22
|
+
}
|
|
23
|
+
this.webex = this.sdkConnector.getWebex();
|
|
24
|
+
this.callCollection = {};
|
|
25
|
+
this.activeMobiusUrl = '';
|
|
26
|
+
this.listenForWsEvents();
|
|
27
|
+
}
|
|
28
|
+
createCall = (destination, direction, deviceId) => {
|
|
29
|
+
log.log('Creating call object', {});
|
|
30
|
+
const newCall = createCall(this.activeMobiusUrl, this.webex, destination, direction, deviceId, (correlationId) => {
|
|
31
|
+
delete this.callCollection[correlationId];
|
|
32
|
+
const activeCalls = Object.keys(this.getActiveCalls()).length;
|
|
33
|
+
log.info(`DELETE:: Deleted corelationId: ${newCall.getCorrelationId()} from CallManager, Number of call records :- ${activeCalls}`, {});
|
|
34
|
+
if (activeCalls === 0) {
|
|
35
|
+
this.emit(EVENT_KEYS.ALL_CALLS_CLEARED);
|
|
36
|
+
}
|
|
37
|
+
}, this.serviceIndicator);
|
|
38
|
+
this.callCollection[newCall.getCorrelationId()] = newCall;
|
|
39
|
+
log.log(`New call created with correlationId: ${newCall.getCorrelationId()}`, {});
|
|
40
|
+
log.info(`ADD:: Added corelationId: ${newCall.getCorrelationId()} to CallManager , Number of call records now:- ${Object.keys(this.getActiveCalls()).length}`, {});
|
|
41
|
+
return newCall;
|
|
42
|
+
};
|
|
43
|
+
updateActiveMobius(url) {
|
|
44
|
+
this.activeMobiusUrl = url;
|
|
45
|
+
}
|
|
46
|
+
listenForWsEvents() {
|
|
47
|
+
this.sdkConnector.registerListener('event:mobius', async (event) => {
|
|
48
|
+
this.dequeueWsEvents(event);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
dequeueWsEvents(event) {
|
|
52
|
+
const mobiusEvent = event;
|
|
53
|
+
const { callId, correlationId } = mobiusEvent.data;
|
|
54
|
+
switch (mobiusEvent.data.eventType) {
|
|
55
|
+
case MobiusEventType.CALL_SETUP: {
|
|
56
|
+
log.log(`Received call Setup message for call: ${callId}`, {
|
|
57
|
+
file: CALL_MANAGER_FILE,
|
|
58
|
+
method: 'dequeueWsEvents',
|
|
59
|
+
});
|
|
60
|
+
if (mobiusEvent.data.midCallService) {
|
|
61
|
+
mobiusEvent.data.midCallService.forEach((midCallEvent) => {
|
|
62
|
+
const call = this.getCall(correlationId);
|
|
63
|
+
if (call) {
|
|
64
|
+
call.handleMidCallEvent(midCallEvent);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
log.log(`Dropping midcall event of type: ${midCallEvent.eventType} as it doesn't match with any existing call`, {
|
|
68
|
+
file: CALL_MANAGER_FILE,
|
|
69
|
+
method: 'dequeueWsEvents',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const newId = Object.keys(this.callCollection).find((id) => this.callCollection[id].getCallId() === callId);
|
|
76
|
+
let newCall;
|
|
77
|
+
if (!newId) {
|
|
78
|
+
newCall = this.createCall({}, CallDirection.INBOUND, mobiusEvent.data.deviceId);
|
|
79
|
+
log.log(`New incoming call created with correlationId from Call Setup message: ${newCall.getCorrelationId()}`, {
|
|
80
|
+
file: CALL_MANAGER_FILE,
|
|
81
|
+
method: 'dequeueWsEvents',
|
|
82
|
+
});
|
|
83
|
+
newCall.setCallId(callId);
|
|
84
|
+
if (mobiusEvent.data.broadworksCorrelationInfo) {
|
|
85
|
+
log.log(`Found broadworksCorrelationInfo: ${mobiusEvent.data.broadworksCorrelationInfo}`, {
|
|
86
|
+
file: CALL_MANAGER_FILE,
|
|
87
|
+
method: 'dequeueWsEvents',
|
|
88
|
+
});
|
|
89
|
+
newCall.setBroadworksCorrelationInfo(mobiusEvent.data.broadworksCorrelationInfo);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
log.info(`Found the call Object with a matching callId: ${callId} from our records with correlationId: ${newId}`, {
|
|
94
|
+
file: CALL_MANAGER_FILE,
|
|
95
|
+
method: 'dequeueWsEvents',
|
|
96
|
+
});
|
|
97
|
+
newCall = this.getCall(newId);
|
|
98
|
+
}
|
|
99
|
+
if (mobiusEvent.data.callerId) {
|
|
100
|
+
log.info('Processing Caller-Id data', {
|
|
101
|
+
file: CALL_MANAGER_FILE,
|
|
102
|
+
method: 'dequeueWsEvents',
|
|
103
|
+
});
|
|
104
|
+
newCall.startCallerIdResolution(mobiusEvent.data.callerId);
|
|
105
|
+
}
|
|
106
|
+
this.emit(EVENT_KEYS.INCOMING_CALL, newCall);
|
|
107
|
+
newCall.sendCallStateMachineEvt({ type: 'E_RECV_CALL_SETUP', data: mobiusEvent.data });
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
case MobiusEventType.CALL_PROGRESS: {
|
|
111
|
+
log.log(`Received call progress mobiusEvent for call: ${correlationId}`, {
|
|
112
|
+
file: CALL_MANAGER_FILE,
|
|
113
|
+
method: 'dequeueWsEvents',
|
|
114
|
+
});
|
|
115
|
+
const call = this.getCall(correlationId);
|
|
116
|
+
call.sendCallStateMachineEvt({ type: 'E_RECV_CALL_PROGRESS', data: mobiusEvent.data });
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case MobiusEventType.CALL_MEDIA: {
|
|
120
|
+
log.log(`Received call media mobiusEvent for call: ${correlationId}`, {
|
|
121
|
+
file: CALL_MANAGER_FILE,
|
|
122
|
+
method: 'dequeueWsEvents',
|
|
123
|
+
});
|
|
124
|
+
let activeCall;
|
|
125
|
+
if (correlationId) {
|
|
126
|
+
activeCall = this.getCall(correlationId);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const newId = Object.keys(this.callCollection).find((id) => this.callCollection[id].getCallId() === callId);
|
|
130
|
+
if (newId) {
|
|
131
|
+
log.info(`Found the call Object with a matching callId: ${callId} from our records with correlationId: ${newId}`, {
|
|
132
|
+
file: CALL_MANAGER_FILE,
|
|
133
|
+
method: 'dequeueWsEvents',
|
|
134
|
+
});
|
|
135
|
+
activeCall = this.getCall(newId);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
activeCall = this.createCall({}, CallDirection.INBOUND, mobiusEvent.data.deviceId);
|
|
139
|
+
log.log(`New incoming call created with correlationId from ROAP Message: ${activeCall.getCorrelationId()}`, {
|
|
140
|
+
file: CALL_MANAGER_FILE,
|
|
141
|
+
method: 'dequeueWsEvents',
|
|
142
|
+
});
|
|
143
|
+
activeCall.setCallId(callId);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (activeCall) {
|
|
147
|
+
log.info(`SDP from mobius ${mobiusEvent.data.message?.sdp}`, {
|
|
148
|
+
file: CALL_MANAGER_FILE,
|
|
149
|
+
method: 'dequeueWsEvents',
|
|
150
|
+
});
|
|
151
|
+
log.log(`ROAP message from mobius with type: ${mobiusEvent.data.message?.messageType}, seq: ${mobiusEvent.data.message?.seq} , version: ${mobiusEvent.data.message?.version}`, {
|
|
152
|
+
file: CALL_MANAGER_FILE,
|
|
153
|
+
method: 'dequeueWsEvents',
|
|
154
|
+
});
|
|
155
|
+
const mediaState = mobiusEvent.data.message?.messageType;
|
|
156
|
+
switch (mediaState) {
|
|
157
|
+
case MediaState.OFFER: {
|
|
158
|
+
log.log('Received OFFER', {
|
|
159
|
+
file: CALL_MANAGER_FILE,
|
|
160
|
+
method: 'dequeueWsEvents',
|
|
161
|
+
});
|
|
162
|
+
activeCall.sendMediaStateMachineEvt({
|
|
163
|
+
type: 'E_RECV_ROAP_OFFER',
|
|
164
|
+
data: mobiusEvent.data.message,
|
|
165
|
+
});
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
case MediaState.ANSWER: {
|
|
169
|
+
log.log('Received ANSWER', {
|
|
170
|
+
file: CALL_MANAGER_FILE,
|
|
171
|
+
method: 'dequeueWsEvents',
|
|
172
|
+
});
|
|
173
|
+
activeCall.sendMediaStateMachineEvt({
|
|
174
|
+
type: 'E_RECV_ROAP_ANSWER',
|
|
175
|
+
data: mobiusEvent.data.message,
|
|
176
|
+
});
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
case MediaState.OFFER_REQUEST: {
|
|
180
|
+
log.log('Received OFFER_REQUEST', {
|
|
181
|
+
file: CALL_MANAGER_FILE,
|
|
182
|
+
method: 'dequeueWsEvents',
|
|
183
|
+
});
|
|
184
|
+
activeCall.sendMediaStateMachineEvt({
|
|
185
|
+
type: 'E_RECV_ROAP_OFFER_REQUEST',
|
|
186
|
+
data: mobiusEvent.data.message,
|
|
187
|
+
});
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
case MediaState.OK: {
|
|
191
|
+
log.log('Received OK', {
|
|
192
|
+
file: CALL_MANAGER_FILE,
|
|
193
|
+
method: 'dequeueWsEvents',
|
|
194
|
+
});
|
|
195
|
+
const mediaOk = {
|
|
196
|
+
received: true,
|
|
197
|
+
message: mobiusEvent.data.message,
|
|
198
|
+
};
|
|
199
|
+
activeCall.sendMediaStateMachineEvt({
|
|
200
|
+
type: 'E_ROAP_OK',
|
|
201
|
+
data: mediaOk,
|
|
202
|
+
});
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
case MediaState.ERROR: {
|
|
206
|
+
log.log('Received Error...', {
|
|
207
|
+
file: CALL_MANAGER_FILE,
|
|
208
|
+
method: 'dequeueWsEvents',
|
|
209
|
+
});
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
default: {
|
|
213
|
+
log.log(`Unknown Media mobiusEvent: ${mediaState} `, {
|
|
214
|
+
file: CALL_MANAGER_FILE,
|
|
215
|
+
method: 'dequeueWsEvents',
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
log.log(`CorrelationId: ${correlationId} doesn't exist , discarding..`, {
|
|
222
|
+
file: CALL_MANAGER_FILE,
|
|
223
|
+
method: 'dequeueWsEvents',
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
case MobiusEventType.CALL_CONNECTED: {
|
|
229
|
+
log.log(`Received call connect for call: ${correlationId}`, {
|
|
230
|
+
file: CALL_MANAGER_FILE,
|
|
231
|
+
method: 'dequeueWsEvents',
|
|
232
|
+
});
|
|
233
|
+
const call = this.getCall(correlationId);
|
|
234
|
+
call.sendCallStateMachineEvt({ type: 'E_RECV_CALL_CONNECT', data: mobiusEvent.data });
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
case MobiusEventType.CALL_DISCONNECTED: {
|
|
238
|
+
log.log(`Received call disconnect for call: ${correlationId}`, {
|
|
239
|
+
file: CALL_MANAGER_FILE,
|
|
240
|
+
method: 'dequeueWsEvents',
|
|
241
|
+
});
|
|
242
|
+
const call = this.getCall(correlationId);
|
|
243
|
+
if (call) {
|
|
244
|
+
call.sendCallStateMachineEvt({ type: 'E_RECV_CALL_DISCONNECT' });
|
|
245
|
+
}
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
default: {
|
|
249
|
+
log.log(`Unknown Call Event mobiusEvent: ${mobiusEvent.data.eventType}`, {
|
|
250
|
+
file: CALL_MANAGER_FILE,
|
|
251
|
+
method: 'dequeueWsEvents',
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
endCall = (correlationId) => {
|
|
257
|
+
const call = this.getCall(correlationId);
|
|
258
|
+
if (call) {
|
|
259
|
+
call.end();
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
getCall = (correlationId) => {
|
|
263
|
+
return this.callCollection[correlationId];
|
|
264
|
+
};
|
|
265
|
+
getActiveCalls = () => {
|
|
266
|
+
return this.callCollection;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
export const getCallManager = (webex, indicator) => {
|
|
270
|
+
if (!callManager) {
|
|
271
|
+
callManager = new CallManager(webex, indicator);
|
|
272
|
+
}
|
|
273
|
+
return callManager;
|
|
274
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export var MobiusEventType;
|
|
2
|
+
(function (MobiusEventType) {
|
|
3
|
+
MobiusEventType["CALL_SETUP"] = "mobius.call";
|
|
4
|
+
MobiusEventType["CALL_PROGRESS"] = "mobius.callprogress";
|
|
5
|
+
MobiusEventType["CALL_CONNECTED"] = "mobius.callconnected";
|
|
6
|
+
MobiusEventType["CALL_MEDIA"] = "mobius.media";
|
|
7
|
+
MobiusEventType["CALL_DISCONNECTED"] = "mobius.calldisconnected";
|
|
8
|
+
})(MobiusEventType || (MobiusEventType = {}));
|
|
9
|
+
export var MediaState;
|
|
10
|
+
(function (MediaState) {
|
|
11
|
+
MediaState["OFFER"] = "OFFER";
|
|
12
|
+
MediaState["ANSWER"] = "ANSWER";
|
|
13
|
+
MediaState["OFFER_REQUEST"] = "OFFER_REQUEST";
|
|
14
|
+
MediaState["OK"] = "OK";
|
|
15
|
+
MediaState["ERROR"] = "ERROR";
|
|
16
|
+
})(MediaState || (MediaState = {}));
|
|
17
|
+
export var DisconnectCode;
|
|
18
|
+
(function (DisconnectCode) {
|
|
19
|
+
DisconnectCode[DisconnectCode["BUSY"] = 115] = "BUSY";
|
|
20
|
+
DisconnectCode[DisconnectCode["NORMAL"] = 0] = "NORMAL";
|
|
21
|
+
DisconnectCode[DisconnectCode["MEDIA_INACTIVITY"] = 131] = "MEDIA_INACTIVITY";
|
|
22
|
+
})(DisconnectCode || (DisconnectCode = {}));
|
|
23
|
+
export var DisconnectCause;
|
|
24
|
+
(function (DisconnectCause) {
|
|
25
|
+
DisconnectCause["BUSY"] = "User Busy.";
|
|
26
|
+
DisconnectCause["NORMAL"] = "Normal Disconnect.";
|
|
27
|
+
DisconnectCause["MEDIA_INACTIVITY"] = "Media Inactivity.";
|
|
28
|
+
})(DisconnectCause || (DisconnectCause = {}));
|
|
29
|
+
export var MidCallEventType;
|
|
30
|
+
(function (MidCallEventType) {
|
|
31
|
+
MidCallEventType["CALL_INFO"] = "callInfo";
|
|
32
|
+
MidCallEventType["CALL_STATE"] = "callState";
|
|
33
|
+
})(MidCallEventType || (MidCallEventType = {}));
|
|
34
|
+
export var RoapScenario;
|
|
35
|
+
(function (RoapScenario) {
|
|
36
|
+
RoapScenario["ANSWER"] = "ANSWER";
|
|
37
|
+
RoapScenario["OK"] = "OK";
|
|
38
|
+
RoapScenario["OFFER"] = "OFFER";
|
|
39
|
+
RoapScenario["ERROR"] = "ERROR";
|
|
40
|
+
RoapScenario["OFFER_RESPONSE"] = "OFFER_RESPONSE";
|
|
41
|
+
})(RoapScenario || (RoapScenario = {}));
|
|
42
|
+
export var MobiusCallState;
|
|
43
|
+
(function (MobiusCallState) {
|
|
44
|
+
MobiusCallState["PROCEEDING"] = "sig_proceeding";
|
|
45
|
+
MobiusCallState["PROGRESS"] = "sig_progress";
|
|
46
|
+
MobiusCallState["ALERTING"] = "sig_alerting";
|
|
47
|
+
MobiusCallState["CONNECTED"] = "sig_connected";
|
|
48
|
+
})(MobiusCallState || (MobiusCallState = {}));
|
|
49
|
+
export var TransferType;
|
|
50
|
+
(function (TransferType) {
|
|
51
|
+
TransferType["BLIND"] = "BLIND";
|
|
52
|
+
TransferType["CONSULT"] = "CONSULT";
|
|
53
|
+
})(TransferType || (TransferType = {}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getMobiusDiscoveryResponse, getTestUtilsWebex } from '../common/testUtil';
|
|
2
|
+
import { URL_ENDPOINT } from './constants';
|
|
3
|
+
import { mockPostResponse } from './registration/registerFixtures';
|
|
4
|
+
const webex = getTestUtilsWebex();
|
|
5
|
+
const mockIPReturnBody = {
|
|
6
|
+
ipv4: '1.1.1.1',
|
|
7
|
+
ipv6: '2.2.2.2',
|
|
8
|
+
};
|
|
9
|
+
const ipPayload = {
|
|
10
|
+
statusCode: 200,
|
|
11
|
+
body: mockIPReturnBody,
|
|
12
|
+
};
|
|
13
|
+
const regionBody = {
|
|
14
|
+
attribution: 'This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com',
|
|
15
|
+
clientAddress: '72.163.220.6',
|
|
16
|
+
clientRegion: 'AP-SOUTHEAST',
|
|
17
|
+
countryCode: 'IN',
|
|
18
|
+
disclaimer: 'This service is intended for use by Webex Team only. Unauthorized use is prohibited.',
|
|
19
|
+
regionCode: 'AP-SOUTHEAST',
|
|
20
|
+
timezone: 'Asia/Kolkata',
|
|
21
|
+
};
|
|
22
|
+
const regionPayload = {
|
|
23
|
+
statusCode: 200,
|
|
24
|
+
body: regionBody,
|
|
25
|
+
};
|
|
26
|
+
const discoveryBody = getMobiusDiscoveryResponse();
|
|
27
|
+
const primaryUrl = `${discoveryBody.primary.uris[0]}/calling/web/`;
|
|
28
|
+
const discoveryPayload = {
|
|
29
|
+
statusCode: 200,
|
|
30
|
+
body: discoveryBody,
|
|
31
|
+
};
|
|
32
|
+
const registrationPayload = {
|
|
33
|
+
statusCode: 200,
|
|
34
|
+
body: mockPostResponse,
|
|
35
|
+
};
|
|
36
|
+
const uri = `${webex.internal.services._serviceUrls.mobius}${URL_ENDPOINT}`;
|
|
37
|
+
const myIP = mockIPReturnBody.ipv4;
|
|
38
|
+
export { ipPayload, regionBody, regionPayload, primaryUrl, discoveryPayload, registrationPayload, uri, myIP, };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export const VERSION = '1.71.1';
|
|
2
|
+
export const REPO_NAME = 'web-calling-sdk';
|
|
3
|
+
export const CALLING_FEATURE = 'web-calling';
|
|
4
|
+
export const CALLING_USER_AGENT = `${REPO_NAME}/${VERSION} (${CALLING_FEATURE})`;
|
|
5
|
+
export const CALL_ENDPOINT_RESOURCE = 'call';
|
|
6
|
+
export const CALL_STATUS_RESOURCE = 'status';
|
|
7
|
+
export const CALLS_ENDPOINT_RESOURCE = 'calls';
|
|
8
|
+
export const CISCO_DEVICE_URL = 'cisco-device-url';
|
|
9
|
+
export const CRLF = '\r\n';
|
|
10
|
+
export const DEFAULT_KEEPALIVE_INTERVAL = 30;
|
|
11
|
+
export const DEFAULT_LOCAL_CALL_ID = 'DefaultLocalId';
|
|
12
|
+
export const DEFAULT_REHOMING_INTERVAL_MAX = 120;
|
|
13
|
+
export const DEFAULT_REHOMING_INTERVAL_MIN = 60;
|
|
14
|
+
export const DEFAULT_SESSION_TIMER = 1000 * 60 * 10;
|
|
15
|
+
export const DEVICES_ENDPOINT_RESOURCE = 'devices';
|
|
16
|
+
export const DISCOVERY_URL = 'https://ds.ciscospark.com/v1/region';
|
|
17
|
+
export const DUMMY_METRICS = {
|
|
18
|
+
'rtp-rxstat': {
|
|
19
|
+
Dur: 0,
|
|
20
|
+
Pkt: 0,
|
|
21
|
+
Oct: 0,
|
|
22
|
+
LatePkt: 0,
|
|
23
|
+
LostPkt: 0,
|
|
24
|
+
AvgJit: 0,
|
|
25
|
+
VQMetrics: {
|
|
26
|
+
VoRxCodec: 'unknown',
|
|
27
|
+
VoPktSizeMs: 0,
|
|
28
|
+
maxJitter: 0,
|
|
29
|
+
VoOneWayDelayMs: 0,
|
|
30
|
+
networkType: 'unknown',
|
|
31
|
+
hwType: 'unknown',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
'rtp-txstat': {
|
|
35
|
+
Dur: 0,
|
|
36
|
+
Pkt: 0,
|
|
37
|
+
Oct: 0,
|
|
38
|
+
VQMetrics: {
|
|
39
|
+
VoTxCodec: 'unknown',
|
|
40
|
+
rtpBitRate: 0,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const DUMMY_MOBIUS_URL = 'https://mobius.aintgen-a-1.int.infra.webex.com/api/v1';
|
|
45
|
+
export const FETCH_NAME = /^[a-zA-Z ]+/;
|
|
46
|
+
export const IDENTITY_BROKER = 'https://identitybts.webex.com/';
|
|
47
|
+
export const IP_ENDPOINT = 'myip';
|
|
48
|
+
export const IDENTITY_ENDPOINT_RESOURCE = 'identity';
|
|
49
|
+
export const INITIAL_SEQ_NUMBER = 1;
|
|
50
|
+
export const MEDIA_ENDPOINT_RESOURCE = 'media';
|
|
51
|
+
export const NETWORK_FLAP_TIMEOUT = 2000;
|
|
52
|
+
export const CALL_HOLD_SERVICE = 'callhold';
|
|
53
|
+
export const CALL_TRANSFER_SERVICE = 'calltransfer';
|
|
54
|
+
export const HOLD_ENDPOINT = 'hold';
|
|
55
|
+
export const TRANSFER_ENDPOINT = 'commit';
|
|
56
|
+
export const RESUME_ENDPOINT = 'resume';
|
|
57
|
+
export const SCIM_ENDPOINT_RESOURCE = 'scim';
|
|
58
|
+
export const SCIM_USER_FILTER = 'v1/Users?filter=';
|
|
59
|
+
export const SPARK_USER_AGENT = 'spark-user-agent';
|
|
60
|
+
export const REGISTER_RETRY_TIMEOUT = 10000;
|
|
61
|
+
export const SUPPLEMENTARY_SERVICES_TIMEOUT = 10000;
|
|
62
|
+
export const URL_ENDPOINT = '/calling/web/';
|
|
63
|
+
export const VALID_PHONE = /[\d\s()*#+.-]+/;
|
|
64
|
+
export const WEB_AGENT = '(web)';
|
|
65
|
+
export const WEBEX = 'webex';
|
|
66
|
+
export const WEBEX_WEB_CLIENT = 'webex-web-client';
|
|
67
|
+
export const CALLER_ID_FILE = 'CallerId';
|
|
68
|
+
export const UTILS_FILE = 'utils';
|
|
69
|
+
export const CALLING_CLIENT_FILE = 'CallingClient';
|
|
70
|
+
export const LINE_FILE = 'line';
|
|
71
|
+
export const CALL_FILE = 'call';
|
|
72
|
+
export const CALL_MANAGER_FILE = 'callManager';
|
|
73
|
+
export const METRIC_FILE = 'metric';
|
|
74
|
+
export const REGISTRATION_FILE = 'register';
|
|
75
|
+
export const CODEC_ID = 'codecId';
|
|
76
|
+
export const MEDIA_ID = 'id';
|
|
77
|
+
export const RTC_ICE_CANDIDATE_PAIR = 'RTCIceCandidatePair_';
|
|
78
|
+
export const LOCAL_CANDIDATE_ID = 'localCandidateId';
|
|
79
|
+
export const RTC_ICE_CANDIDATE = 'RTCIceCandidate_';
|
|
80
|
+
export const NETWORK_TYPE = 'networkType';
|
|
81
|
+
export const RTC_CODEC = 'RTCCodec_';
|
|
82
|
+
export const INBOUND_CODEC_MATCH = 'CIT01_';
|
|
83
|
+
export const OUTBOUND_CODEC_MATCH = 'COT01_';
|
|
84
|
+
export const MIME_TYPE = 'mimeType';
|
|
85
|
+
export const REMOTE_INBOUND_RTP = 'remote-inbound-rtp';
|
|
86
|
+
export const TOTAL_ROUND_TRIP_TIME = 'totalRoundTripTime';
|
|
87
|
+
export const ROUND_TRIP_TIME_MEASUREMENTS = 'roundTripTimeMeasurements';
|
|
88
|
+
export const INBOUND_RTP = 'inbound-rtp';
|
|
89
|
+
export const OUTBOUND_RTP = 'outbound-rtp';
|
|
90
|
+
export const PACKETS_RECEIVED = 'packetsReceived';
|
|
91
|
+
export const PACKETS_SENT = 'packetsSent';
|
|
92
|
+
export const PACKETS_LOST = 'packetsLost';
|
|
93
|
+
export const PACKETS_DISCARDED = 'packetsDiscarded';
|
|
94
|
+
export const JITTER_BUFFER_DELAY = 'jitterBufferDelay';
|
|
95
|
+
export const JITTER_BUFFER_EMITTED_COUNT = 'jitterBufferEmittedCount';
|
|
96
|
+
export const TIMESTAMP = 'timestamp';
|
|
97
|
+
export const TYPE = 'type';
|
|
98
|
+
export const TRANSPORT = 'transport';
|
|
99
|
+
export const TARGET_BIT_RATE = 'targetBitrate';
|
|
100
|
+
export const MEDIA_SOURCE = 'media-source';
|
|
101
|
+
export const BYTES_RECEIVED = 'bytesReceived';
|
|
102
|
+
export const BYTES_SENT = 'bytesSent';
|
|
103
|
+
export const SELECTED_CANDIDATE_PAIR_ID = 'selectedCandidatePairId';
|
|
104
|
+
export const TOTAL_SAMPLES_DURATION = 'totalSamplesDuration';
|
|
105
|
+
export const RTP_RX_STAT = 'rtp-rxstat';
|
|
106
|
+
export const RTP_TX_STAT = 'rtp-txstat';
|
|
107
|
+
export const BASE_REG_TIMER_MFACTOR = 2;
|
|
108
|
+
export const BASE_REG_RETRY_TIMER_VAL_IN_SEC = 30;
|
|
109
|
+
export const SEC_TO_MSEC_MFACTOR = 1000;
|
|
110
|
+
export const MINUTES_TO_SEC_MFACTOR = 60;
|
|
111
|
+
export const REG_RANDOM_T_FACTOR_UPPER_LIMIT = 10000;
|
|
112
|
+
export const REG_TRY_BACKUP_TIMER_VAL_IN_SEC = 1200;
|
|
113
|
+
export const REG_FAILBACK_429_MAX_RETRIES = 5;
|
|
114
|
+
export const REGISTER_UTIL = 'registerDevice';
|
|
115
|
+
export const GET_MOBIUS_SERVERS_UTIL = 'getMobiusServers';
|
|
116
|
+
export const KEEPALIVE_UTIL = 'startKeepaliveTimer';
|
|
117
|
+
export const FAILBACK_UTIL = 'executeFailback';
|
|
118
|
+
export const FAILBACK_429_RETRY_UTIL = 'scheduleFailback429Retry';
|
|
119
|
+
export const FAILOVER_UTIL = 'startFailoverTimer';
|
|
120
|
+
export const NETWORK_CHANGE_DETECTION_UTIL = 'detectNetworkChange';
|
|
121
|
+
export const CALLS_CLEARED_HANDLER_UTIL = 'callsClearedHandler';
|
|
122
|
+
export const RECONNECT_UTIL = 'reconnectOnFailure';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { v4 as uuid } from 'uuid';
|
|
2
|
+
import { MobiusStatus, ServiceIndicator } from '../../common/types';
|
|
3
|
+
import { LINE_EVENTS } from './types';
|
|
4
|
+
import { LINE_FILE } from '../constants';
|
|
5
|
+
import log from '../../Logger';
|
|
6
|
+
import { createRegistration } from '../registration';
|
|
7
|
+
import { Eventing } from '../../Events/impl';
|
|
8
|
+
import { validateServiceData } from '../../common';
|
|
9
|
+
import SDKConnector from '../../SDKConnector';
|
|
10
|
+
export default class Line extends Eventing {
|
|
11
|
+
#webex;
|
|
12
|
+
#mutex;
|
|
13
|
+
#sdkConnector;
|
|
14
|
+
registration;
|
|
15
|
+
userId;
|
|
16
|
+
clientDeviceUri;
|
|
17
|
+
lineId;
|
|
18
|
+
mobiusDeviceId;
|
|
19
|
+
mobiusUri;
|
|
20
|
+
phoneNumber;
|
|
21
|
+
extension;
|
|
22
|
+
status;
|
|
23
|
+
sipAddresses;
|
|
24
|
+
voicemail;
|
|
25
|
+
lastSeen;
|
|
26
|
+
keepaliveInterval;
|
|
27
|
+
callKeepaliveInterval;
|
|
28
|
+
rehomingIntervalMin;
|
|
29
|
+
rehomingIntervalMax;
|
|
30
|
+
voicePortalNumber;
|
|
31
|
+
voicePortalExtension;
|
|
32
|
+
#primaryMobiusUris;
|
|
33
|
+
#backupMobiusUris;
|
|
34
|
+
constructor(userId, clientDeviceUri, status, mutex, primaryMobiusUris, backupMobiusUris, logLevel, serviceDataConfig, phoneNumber, extension, voicemail) {
|
|
35
|
+
super();
|
|
36
|
+
this.lineId = uuid();
|
|
37
|
+
this.userId = userId;
|
|
38
|
+
this.clientDeviceUri = clientDeviceUri;
|
|
39
|
+
this.status = status;
|
|
40
|
+
this.phoneNumber = phoneNumber;
|
|
41
|
+
this.extension = extension;
|
|
42
|
+
this.voicemail = voicemail;
|
|
43
|
+
this.#sdkConnector = SDKConnector;
|
|
44
|
+
this.#webex = this.#sdkConnector.getWebex();
|
|
45
|
+
this.#mutex = mutex;
|
|
46
|
+
this.#primaryMobiusUris = primaryMobiusUris;
|
|
47
|
+
this.#backupMobiusUris = backupMobiusUris;
|
|
48
|
+
const serviceData = serviceDataConfig?.indicator
|
|
49
|
+
? serviceDataConfig
|
|
50
|
+
: { indicator: ServiceIndicator.CALLING, domain: '' };
|
|
51
|
+
validateServiceData(serviceData);
|
|
52
|
+
this.registration = createRegistration(this.#webex, serviceData, this.#mutex, this.lineEmitter, logLevel);
|
|
53
|
+
this.registration.setStatus(MobiusStatus.DEFAULT);
|
|
54
|
+
log.setLogger(logLevel, LINE_FILE);
|
|
55
|
+
}
|
|
56
|
+
async register() {
|
|
57
|
+
await this.#mutex.runExclusive(async () => {
|
|
58
|
+
this.registration.setStatus(MobiusStatus.DEFAULT);
|
|
59
|
+
this.emit(LINE_EVENTS.CONNECTING);
|
|
60
|
+
this.registration.setMobiusServers(this.#primaryMobiusUris, this.#backupMobiusUris);
|
|
61
|
+
await this.registration.triggerRegistration();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async deregister() {
|
|
65
|
+
this.registration.deregister();
|
|
66
|
+
}
|
|
67
|
+
normalizeLine(deviceInfo) {
|
|
68
|
+
const { device, keepaliveInterval, callKeepaliveInterval, rehomingIntervalMin, rehomingIntervalMax, voicePortalNumber, voicePortalExtension, } = deviceInfo;
|
|
69
|
+
this.mobiusDeviceId = device?.deviceId;
|
|
70
|
+
this.mobiusUri = device?.uri;
|
|
71
|
+
this.lastSeen = device?.lastSeen;
|
|
72
|
+
this.sipAddresses = device?.addresses;
|
|
73
|
+
this.keepaliveInterval = keepaliveInterval;
|
|
74
|
+
this.callKeepaliveInterval = callKeepaliveInterval;
|
|
75
|
+
this.rehomingIntervalMin = rehomingIntervalMin;
|
|
76
|
+
this.rehomingIntervalMax = rehomingIntervalMax;
|
|
77
|
+
this.voicePortalNumber = voicePortalNumber;
|
|
78
|
+
this.voicePortalExtension = voicePortalExtension;
|
|
79
|
+
}
|
|
80
|
+
lineEmitter = (event, deviceInfo, lineError) => {
|
|
81
|
+
switch (event) {
|
|
82
|
+
case LINE_EVENTS.REGISTERED:
|
|
83
|
+
if (deviceInfo) {
|
|
84
|
+
this.normalizeLine(deviceInfo);
|
|
85
|
+
this.emit(event, this);
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case LINE_EVENTS.UNREGISTERED:
|
|
89
|
+
case LINE_EVENTS.RECONNECTED:
|
|
90
|
+
case LINE_EVENTS.RECONNECTING:
|
|
91
|
+
this.emit(event);
|
|
92
|
+
break;
|
|
93
|
+
case LINE_EVENTS.ERROR:
|
|
94
|
+
if (lineError) {
|
|
95
|
+
this.emit(event, lineError);
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
default:
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
getLoggingLevel() {
|
|
103
|
+
return log.getLogLevel();
|
|
104
|
+
}
|
|
105
|
+
getActiveMobiusUrl() {
|
|
106
|
+
return this.registration.getActiveMobiusUrl();
|
|
107
|
+
}
|
|
108
|
+
getRegistrationStatus = () => this.registration.getStatus();
|
|
109
|
+
getDeviceId = () => this.registration.getDeviceInfo().device?.deviceId;
|
|
110
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export var LineStatus;
|
|
2
|
+
(function (LineStatus) {
|
|
3
|
+
LineStatus["INACTIVE"] = "inactive";
|
|
4
|
+
LineStatus["ACTIVE"] = "active";
|
|
5
|
+
})(LineStatus || (LineStatus = {}));
|
|
6
|
+
export var LINE_EVENTS;
|
|
7
|
+
(function (LINE_EVENTS) {
|
|
8
|
+
LINE_EVENTS["CONNECTING"] = "connecting";
|
|
9
|
+
LINE_EVENTS["ERROR"] = "error";
|
|
10
|
+
LINE_EVENTS["RECONNECTED"] = "reconnected";
|
|
11
|
+
LINE_EVENTS["RECONNECTING"] = "reconnecting";
|
|
12
|
+
LINE_EVENTS["REGISTERED"] = "registered";
|
|
13
|
+
LINE_EVENTS["UNREGISTERED"] = "unregistered";
|
|
14
|
+
})(LINE_EVENTS || (LINE_EVENTS = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './register';
|