@webex/calling 3.12.0-task-refactor.1 → 3.12.0-webex-services-ready.2
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/dist/CallHistory/CallHistory.js +68 -51
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallRecording/CallRecording.js +160 -0
- package/dist/CallRecording/CallRecording.js.map +1 -0
- package/dist/CallRecording/CallRecording.test.js +257 -0
- package/dist/CallRecording/CallRecording.test.js.map +1 -0
- package/dist/CallRecording/WxcCallRecordingConnector.js +577 -0
- package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js +652 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -0
- package/dist/CallRecording/callRecordingFixtures.js +235 -0
- package/dist/CallRecording/callRecordingFixtures.js.map +1 -0
- package/dist/CallRecording/constants.js +50 -0
- package/dist/CallRecording/constants.js.map +1 -0
- package/dist/CallRecording/types.js +137 -0
- package/dist/CallRecording/types.js.map +1 -0
- package/dist/CallRecording/utils.js +42 -0
- package/dist/CallRecording/utils.js.map +1 -0
- package/dist/CallRecording/utils.test.js +97 -0
- package/dist/CallRecording/utils.test.js.map +1 -0
- package/dist/CallingClient/CallingClient.js +520 -193
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +607 -133
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +599 -454
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +834 -443
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +88 -31
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +123 -0
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/types.js +2 -0
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/constants.js +30 -3
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +4 -1
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +16 -1
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +740 -407
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +380 -58
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +41 -104
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +39 -153
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/utils/constants.js +58 -0
- package/dist/CallingClient/utils/constants.js.map +1 -0
- package/dist/CallingClient/utils/index.js +63 -0
- package/dist/CallingClient/utils/index.js.map +1 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.test.js +221 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
- package/dist/CallingClient/utils/request.js +435 -0
- package/dist/CallingClient/utils/request.js.map +1 -0
- package/dist/CallingClient/utils/request.test.js +999 -0
- package/dist/CallingClient/utils/request.test.js.map +1 -0
- package/dist/CallingClient/utils/types.js +7 -0
- package/dist/CallingClient/utils/types.js.map +1 -0
- package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
- package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
- package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
- package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +13 -11
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +3 -8
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Events/types.js +38 -11
- package/dist/Events/types.js.map +1 -1
- package/dist/Metrics/index.js +63 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +357 -1
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +19 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/api.js +56 -0
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +161 -53
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +207 -46
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +10 -5
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +3 -0
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +165 -40
- package/dist/index.js.map +1 -1
- package/dist/mobius-socket/config.js +24 -0
- package/dist/mobius-socket/config.js.map +1 -0
- package/dist/mobius-socket/errors.js +143 -0
- package/dist/mobius-socket/errors.js.map +1 -0
- package/dist/mobius-socket/errors.test.js +20 -0
- package/dist/mobius-socket/errors.test.js.map +1 -0
- package/dist/mobius-socket/index.js +57 -0
- package/dist/mobius-socket/index.js.map +1 -0
- package/dist/mobius-socket/mobius-socket-events.test.js +492 -0
- package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
- package/dist/mobius-socket/mobius-socket.js +849 -0
- package/dist/mobius-socket/mobius-socket.js.map +1 -0
- package/dist/mobius-socket/mobius-socket.test.js +1898 -0
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
- package/dist/mobius-socket/socket/constants.js +55 -0
- package/dist/mobius-socket/socket/constants.js.map +1 -0
- package/dist/mobius-socket/socket/index.js +15 -0
- package/dist/mobius-socket/socket/index.js.map +1 -0
- package/dist/mobius-socket/socket/socket-base.js +604 -0
- package/dist/mobius-socket/socket/socket-base.js.map +1 -0
- package/dist/mobius-socket/socket/socket.js +19 -0
- package/dist/mobius-socket/socket/socket.js.map +1 -0
- package/dist/mobius-socket/socket/socket.shim.js +26 -0
- package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
- package/dist/mobius-socket/socket/types.js +7 -0
- package/dist/mobius-socket/socket/types.js.map +1 -0
- package/dist/mobius-socket/socket.test.js +727 -0
- package/dist/mobius-socket/socket.test.js.map +1 -0
- package/dist/mobius-socket/test/mocha-helpers.js +23 -0
- package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
- package/dist/mobius-socket/test/promise-tick.js +28 -0
- package/dist/mobius-socket/test/promise-tick.js.map +1 -0
- package/dist/mobius-socket/types.js +7 -0
- package/dist/mobius-socket/types.js.map +1 -0
- package/dist/module/CallHistory/CallHistory.js +28 -17
- package/dist/module/CallRecording/CallRecording.js +56 -0
- package/dist/module/CallRecording/WxcCallRecordingConnector.js +257 -0
- package/dist/module/CallRecording/callRecordingFixtures.js +201 -0
- package/dist/module/CallRecording/constants.js +28 -0
- package/dist/module/CallRecording/types.js +19 -0
- package/dist/module/CallRecording/utils.js +14 -0
- package/dist/module/CallingClient/CallingClient.js +166 -8
- package/dist/module/CallingClient/calling/call.js +181 -64
- package/dist/module/CallingClient/calling/callManager.js +46 -7
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +26 -0
- package/dist/module/CallingClient/line/index.js +2 -2
- package/dist/module/CallingClient/registration/register.js +247 -63
- package/dist/module/CallingClient/registration/webWorker.js +42 -61
- package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
- package/dist/module/CallingClient/utils/constants.js +36 -0
- package/dist/module/CallingClient/utils/index.js +5 -0
- package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
- package/dist/module/CallingClient/utils/request.js +211 -0
- package/dist/module/CallingClient/utils/types.js +1 -0
- package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
- package/dist/module/Contacts/ContactsClient.js +1 -1
- package/dist/module/Events/types.js +23 -10
- package/dist/module/Metrics/index.js +48 -1
- package/dist/module/Metrics/types.js +18 -0
- package/dist/module/api.js +3 -2
- package/dist/module/common/Utils.js +65 -18
- package/dist/module/common/testUtil.js +6 -1
- package/dist/module/common/types.js +3 -0
- package/dist/module/index.js +7 -3
- package/dist/module/mobius-socket/config.js +15 -0
- package/dist/module/mobius-socket/errors.js +58 -0
- package/dist/module/mobius-socket/index.js +24 -0
- package/dist/module/mobius-socket/mobius-socket.js +593 -0
- package/dist/module/mobius-socket/socket/constants.js +26 -0
- package/dist/module/mobius-socket/socket/index.js +4 -0
- package/dist/module/mobius-socket/socket/socket-base.js +368 -0
- package/dist/module/mobius-socket/socket/socket.js +9 -0
- package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
- package/dist/module/mobius-socket/socket/types.js +1 -0
- package/dist/module/mobius-socket/types.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallRecording/CallRecording.d.ts +18 -0
- package/dist/types/CallRecording/CallRecording.d.ts.map +1 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +23 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts +61 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -0
- package/dist/types/CallRecording/constants.d.ts +29 -0
- package/dist/types/CallRecording/constants.d.ts.map +1 -0
- package/dist/types/CallRecording/types.d.ts +176 -0
- package/dist/types/CallRecording/types.d.ts.map +1 -0
- package/dist/types/CallRecording/utils.d.ts +3 -0
- package/dist/types/CallRecording/utils.d.ts.map +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts +10 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +12 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +4 -2
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +34 -9
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +26 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +9 -2
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -3
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +3 -1
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/CallingClient/utils/constants.d.ts +35 -0
- package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/index.d.ts +6 -0
- package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
- package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/request.d.ts +28 -0
- package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/types.d.ts +34 -0
- package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
- package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
- package/dist/types/Events/types.d.ts +79 -15
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +19 -2
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +39 -12
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +6 -4
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +11 -3
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +5 -1
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +9 -1
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +8 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mobius-socket/config.d.ts +17 -0
- package/dist/types/mobius-socket/config.d.ts.map +1 -0
- package/dist/types/mobius-socket/errors.d.ts +32 -0
- package/dist/types/mobius-socket/errors.d.ts.map +1 -0
- package/dist/types/mobius-socket/index.d.ts +14 -0
- package/dist/types/mobius-socket/index.d.ts.map +1 -0
- package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
- package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/constants.d.ts +27 -0
- package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/index.d.ts +5 -0
- package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
- package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
- package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
- package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/types.d.ts +61 -0
- package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
- package/dist/types/mobius-socket/types.d.ts +21 -0
- package/dist/types/mobius-socket/types.d.ts.map +1 -0
- package/package.json +20 -5
- package/src/mobius-socket/socket/socket.shim.ts +22 -0
- package/src/mobius-socket/socket/socket.ts +14 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MediaConnectionEventNames, LocalStreamEventNames, RoapMediaConnection, } from '@webex/internal-media-core';
|
|
2
2
|
import { createMachine, interpret } from 'xstate';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
|
-
import { EffectEvent } from '@webex/
|
|
4
|
+
import { EffectEvent } from '@webex/media-helpers';
|
|
5
5
|
import { RtcMetrics } from '@webex/internal-plugin-metrics';
|
|
6
6
|
import { ERROR_LAYER, ERROR_TYPE } from '../../Errors/types';
|
|
7
7
|
import { handleCallErrors, modifySdpForIPv4, parseMediaQualityStatistics, serviceErrorCodeHandler, uploadLogs, } from '../../common/Utils';
|
|
@@ -14,9 +14,10 @@ import { CALL_EVENT_KEYS, MEDIA_CONNECTION_EVENT_KEYS, MOBIUS_MIDCALL_STATE, SUP
|
|
|
14
14
|
import { DisconnectCause, DisconnectCode, MidCallEventType, MobiusCallState, MUTE_TYPE, RoapScenario, TransferType, } from './types';
|
|
15
15
|
import log from '../../Logger';
|
|
16
16
|
import { createCallerId } from './CallerId';
|
|
17
|
-
import { METRIC_TYPE, METRIC_EVENT, TRANSFER_ACTION } from '../../Metrics/types';
|
|
17
|
+
import { METRIC_TYPE, METRIC_EVENT, TRANSFER_ACTION, MEDIA_CONNECTION_ACTION, } from '../../Metrics/types';
|
|
18
18
|
import { getMetricManager } from '../../Metrics';
|
|
19
19
|
import { METHOD_START_MESSAGE, SERVICES_ENDPOINT } from '../../common/constants';
|
|
20
|
+
import { APIRequest } from '../utils/request';
|
|
20
21
|
export class Call extends Eventing {
|
|
21
22
|
sdkConnector;
|
|
22
23
|
webex;
|
|
@@ -48,10 +49,143 @@ export class Call extends Eventing {
|
|
|
48
49
|
broadworksCorrelationInfo;
|
|
49
50
|
serviceIndicator;
|
|
50
51
|
mediaNegotiationCompleted;
|
|
52
|
+
connectPending;
|
|
51
53
|
receivedRoapOKSeq;
|
|
52
54
|
localAudioStream;
|
|
53
55
|
rtcMetrics;
|
|
54
56
|
callKeepaliveRetryCount = 0;
|
|
57
|
+
apiRequest;
|
|
58
|
+
handleMediaRoapEvent = async (event) => {
|
|
59
|
+
log.info(`ROAP message to send (rcv from MEDIA-SDK) :
|
|
60
|
+
\n type: ${event.roapMessage?.messageType}, seq: ${event.roapMessage.seq} , version: ${event.roapMessage.version}`, { file: CALL_FILE, method: METHODS.MEDIA_ROAP_EVENTS_LISTENER });
|
|
61
|
+
log.info(`SDP message to send : \n ${event.roapMessage?.sdp}`, {
|
|
62
|
+
file: CALL_FILE,
|
|
63
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
64
|
+
});
|
|
65
|
+
switch (event.roapMessage.messageType) {
|
|
66
|
+
case RoapScenario.OK: {
|
|
67
|
+
const mediaOk = {
|
|
68
|
+
received: false,
|
|
69
|
+
message: event.roapMessage,
|
|
70
|
+
};
|
|
71
|
+
this.sendMediaStateMachineEvt({ type: 'E_ROAP_OK', data: mediaOk });
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case RoapScenario.OFFER: {
|
|
75
|
+
if (!event.roapMessage.sdp) {
|
|
76
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
77
|
+
file: CALL_FILE,
|
|
78
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
79
|
+
});
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
log.info(`before modifying sdp: ${event.roapMessage.sdp}`, {
|
|
83
|
+
file: CALL_FILE,
|
|
84
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
85
|
+
});
|
|
86
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
87
|
+
const sdpVideoPortZero = event.roapMessage.sdp.replace(/^m=(video) (?:\d+) /gim, 'm=$1 0 ');
|
|
88
|
+
log.info(`after modification sdp: ${sdpVideoPortZero}`, {
|
|
89
|
+
file: CALL_FILE,
|
|
90
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
91
|
+
});
|
|
92
|
+
event.roapMessage.sdp = sdpVideoPortZero;
|
|
93
|
+
this.localRoapMessage = event.roapMessage;
|
|
94
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_SETUP', data: event.roapMessage });
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case RoapScenario.ANSWER:
|
|
98
|
+
if (!event.roapMessage.sdp) {
|
|
99
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
100
|
+
file: CALL_FILE,
|
|
101
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
102
|
+
});
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
106
|
+
this.localRoapMessage = event.roapMessage;
|
|
107
|
+
if (this.connectPending) {
|
|
108
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_CONNECT' });
|
|
109
|
+
}
|
|
110
|
+
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_ANSWER', data: event.roapMessage });
|
|
111
|
+
break;
|
|
112
|
+
case RoapScenario.ERROR:
|
|
113
|
+
this.sendMediaStateMachineEvt({ type: 'E_ROAP_ERROR', data: event.roapMessage });
|
|
114
|
+
break;
|
|
115
|
+
case RoapScenario.OFFER_RESPONSE:
|
|
116
|
+
if (!event.roapMessage.sdp) {
|
|
117
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
118
|
+
file: CALL_FILE,
|
|
119
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
120
|
+
});
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
124
|
+
this.localRoapMessage = event.roapMessage;
|
|
125
|
+
if (this.connectPending) {
|
|
126
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_CONNECT' });
|
|
127
|
+
}
|
|
128
|
+
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_OFFER', data: event.roapMessage });
|
|
129
|
+
break;
|
|
130
|
+
default:
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
handleRemoteTrackAdded = (event) => {
|
|
134
|
+
if (event.type === MEDIA_CONNECTION_EVENT_KEYS.MEDIA_TYPE_AUDIO) {
|
|
135
|
+
this.emit(CALL_EVENT_KEYS.REMOTE_MEDIA, event.track);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
static getPeerConnectionStateFromEvent(event, preferredKey) {
|
|
139
|
+
return event[preferredKey] || event.state || 'unknown';
|
|
140
|
+
}
|
|
141
|
+
handleIceGatheringStateChanged = (event) => {
|
|
142
|
+
const iceGatheringState = Call.getPeerConnectionStateFromEvent(event, 'iceGatheringState');
|
|
143
|
+
log.info(`ICE gathering state changed to: ${iceGatheringState}`, {
|
|
144
|
+
file: CALL_FILE,
|
|
145
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
146
|
+
});
|
|
147
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.ICE_GATHERING_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, iceGatheringState);
|
|
148
|
+
};
|
|
149
|
+
handlePeerConnectionStateChanged = (event) => {
|
|
150
|
+
const connectionState = Call.getPeerConnectionStateFromEvent(event, 'connectionState');
|
|
151
|
+
log.info(`Peer connection state changed to: ${connectionState}`, {
|
|
152
|
+
file: CALL_FILE,
|
|
153
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
154
|
+
});
|
|
155
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.PEER_CONNECTION_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, connectionState);
|
|
156
|
+
};
|
|
157
|
+
handleIceConnectionStateChanged = (event) => {
|
|
158
|
+
const iceConnectionState = Call.getPeerConnectionStateFromEvent(event, 'iceConnectionState');
|
|
159
|
+
log.info(`ICE connection state changed to: ${iceConnectionState}`, {
|
|
160
|
+
file: CALL_FILE,
|
|
161
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
162
|
+
});
|
|
163
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.ICE_CONNECTION_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, iceConnectionState);
|
|
164
|
+
};
|
|
165
|
+
handleIceCandidateError = (event) => {
|
|
166
|
+
const iceErrorPayload = {
|
|
167
|
+
address: event.address ?? null,
|
|
168
|
+
errorCode: event.errorCode,
|
|
169
|
+
errorText: event.errorText,
|
|
170
|
+
port: event.port ?? null,
|
|
171
|
+
url: event.url,
|
|
172
|
+
};
|
|
173
|
+
log.warn(`ICE candidate error occurred: ${JSON.stringify(iceErrorPayload)}`, {
|
|
174
|
+
file: CALL_FILE,
|
|
175
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
176
|
+
});
|
|
177
|
+
const callError = createCallError(`ICE candidate error occurred: ${JSON.stringify(iceErrorPayload)}`, { file: CALL_FILE, method: METHODS.MEDIA_ICE_EVENTS_LISTENER }, ERROR_TYPE.CALL_ERROR, this.correlationId, ERROR_LAYER.MEDIA);
|
|
178
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA_ERROR, MEDIA_CONNECTION_ACTION.ICE_CANDIDATE_ERROR, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, undefined, callError);
|
|
179
|
+
};
|
|
180
|
+
handleRoapFailure = (error) => {
|
|
181
|
+
const failureMessage = error.message || 'Unknown ROAP failure received from media SDK';
|
|
182
|
+
log.warn(`ROAP failure occurred: ${failureMessage}`, {
|
|
183
|
+
file: CALL_FILE,
|
|
184
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
185
|
+
});
|
|
186
|
+
const callError = createCallError(`ROAP failure occurred: ${failureMessage}`, { file: CALL_FILE, method: METHODS.MEDIA_ROAP_EVENTS_LISTENER }, ERROR_TYPE.CALL_ERROR, this.correlationId, ERROR_LAYER.MEDIA);
|
|
187
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA_ERROR, MEDIA_CONNECTION_ACTION.ROAP_FAILURE, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, undefined, callError);
|
|
188
|
+
};
|
|
55
189
|
isMuted() {
|
|
56
190
|
return this.muted;
|
|
57
191
|
}
|
|
@@ -86,6 +220,7 @@ export class Call extends Eventing {
|
|
|
86
220
|
this.mobiusUrl = activeUrl;
|
|
87
221
|
this.receivedRoapOKSeq = 0;
|
|
88
222
|
this.mediaNegotiationCompleted = false;
|
|
223
|
+
this.connectPending = false;
|
|
89
224
|
log.info(`Webex Calling Url:- ${this.mobiusUrl}`, {
|
|
90
225
|
file: CALL_FILE,
|
|
91
226
|
method: METHODS.CONSTRUCTOR,
|
|
@@ -102,6 +237,7 @@ export class Call extends Eventing {
|
|
|
102
237
|
this.remoteRoapMessage = null;
|
|
103
238
|
this.disconnectReason = { code: DisconnectCode.NORMAL, cause: DisconnectCause.NORMAL };
|
|
104
239
|
this.rtcMetrics = new RtcMetrics(this.webex, { callId: this.callId }, this.correlationId);
|
|
240
|
+
this.apiRequest = APIRequest.getInstance({ webex: this.webex });
|
|
105
241
|
const callMachine = createMachine({
|
|
106
242
|
schema: {
|
|
107
243
|
context: {},
|
|
@@ -281,6 +417,11 @@ export class Call extends Eventing {
|
|
|
281
417
|
},
|
|
282
418
|
},
|
|
283
419
|
on: {
|
|
420
|
+
E_SEND_CALL_CONNECT: {
|
|
421
|
+
cond: () => this.connectPending,
|
|
422
|
+
target: 'S_SEND_CALL_CONNECT',
|
|
423
|
+
actions: ['outgoingCallConnect'],
|
|
424
|
+
},
|
|
284
425
|
E_CALL_ESTABLISHED: {
|
|
285
426
|
target: 'S_CALL_ESTABLISHED',
|
|
286
427
|
actions: ['callEstablished'],
|
|
@@ -842,6 +983,7 @@ export class Call extends Eventing {
|
|
|
842
983
|
}
|
|
843
984
|
}
|
|
844
985
|
async handleOutgoingCallConnect(event) {
|
|
986
|
+
this.connectPending = false;
|
|
845
987
|
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
|
|
846
988
|
file: CALL_FILE,
|
|
847
989
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
@@ -851,6 +993,7 @@ export class Call extends Eventing {
|
|
|
851
993
|
file: CALL_FILE,
|
|
852
994
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
853
995
|
});
|
|
996
|
+
this.connectPending = true;
|
|
854
997
|
return;
|
|
855
998
|
}
|
|
856
999
|
try {
|
|
@@ -910,10 +1053,11 @@ export class Call extends Eventing {
|
|
|
910
1053
|
clearInterval(this.sessionTimer);
|
|
911
1054
|
}
|
|
912
1055
|
if (this.mediaConnection) {
|
|
1056
|
+
this.unregisterMediaConnectionListeners();
|
|
913
1057
|
this.mediaConnection.close();
|
|
914
1058
|
log.info('Closing media channel', {
|
|
915
1059
|
file: CALL_FILE,
|
|
916
|
-
method: METHODS.
|
|
1060
|
+
method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
|
|
917
1061
|
});
|
|
918
1062
|
}
|
|
919
1063
|
this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
|
|
@@ -953,6 +1097,7 @@ export class Call extends Eventing {
|
|
|
953
1097
|
clearInterval(this.sessionTimer);
|
|
954
1098
|
}
|
|
955
1099
|
if (this.mediaConnection) {
|
|
1100
|
+
this.unregisterMediaConnectionListeners();
|
|
956
1101
|
this.mediaConnection.close();
|
|
957
1102
|
log.info('Closing media channel', {
|
|
958
1103
|
file: CALL_FILE,
|
|
@@ -1006,6 +1151,7 @@ export class Call extends Eventing {
|
|
|
1006
1151
|
file: CALL_FILE,
|
|
1007
1152
|
method: 'scheduleCallKeepaliveInterval',
|
|
1008
1153
|
};
|
|
1154
|
+
clearInterval(this.sessionTimer);
|
|
1009
1155
|
this.sessionTimer = setInterval(async () => {
|
|
1010
1156
|
try {
|
|
1011
1157
|
const res = await this.postStatus();
|
|
@@ -1063,6 +1209,7 @@ export class Call extends Eventing {
|
|
|
1063
1209
|
clearInterval(this.sessionTimer);
|
|
1064
1210
|
}
|
|
1065
1211
|
if (this.mediaConnection) {
|
|
1212
|
+
this.unregisterMediaConnectionListeners();
|
|
1066
1213
|
this.mediaConnection.close();
|
|
1067
1214
|
log.info('Closing media channel', {
|
|
1068
1215
|
file: CALL_FILE,
|
|
@@ -1235,7 +1382,7 @@ export class Call extends Eventing {
|
|
|
1235
1382
|
});
|
|
1236
1383
|
}
|
|
1237
1384
|
catch (err) {
|
|
1238
|
-
log.warn('Failed to
|
|
1385
|
+
log.warn('Failed to send MediaOffer request', {
|
|
1239
1386
|
file: CALL_FILE,
|
|
1240
1387
|
method: METHODS.HANDLE_OUTGOING_ROAP_OFFER,
|
|
1241
1388
|
});
|
|
@@ -1434,6 +1581,7 @@ export class Call extends Eventing {
|
|
|
1434
1581
|
this.initMediaConnection(localAudioTrack);
|
|
1435
1582
|
this.mediaRoapEventsListener();
|
|
1436
1583
|
this.mediaTrackListener();
|
|
1584
|
+
this.mediaIceEventsListener();
|
|
1437
1585
|
this.registerListeners(localAudioStream);
|
|
1438
1586
|
}
|
|
1439
1587
|
if (this.callStateMachine.state.value === 'S_SEND_CALL_PROGRESS') {
|
|
@@ -1464,6 +1612,7 @@ export class Call extends Eventing {
|
|
|
1464
1612
|
this.initMediaConnection(localAudioTrack);
|
|
1465
1613
|
this.mediaRoapEventsListener();
|
|
1466
1614
|
this.mediaTrackListener();
|
|
1615
|
+
this.mediaIceEventsListener();
|
|
1467
1616
|
this.registerListeners(localAudioStream);
|
|
1468
1617
|
}
|
|
1469
1618
|
if (this.mediaStateMachine.state.value === 'S_ROAP_IDLE') {
|
|
@@ -1484,7 +1633,7 @@ export class Call extends Eventing {
|
|
|
1484
1633
|
mediaId: uuid(),
|
|
1485
1634
|
},
|
|
1486
1635
|
};
|
|
1487
|
-
return this.
|
|
1636
|
+
return this.apiRequest.makeRequest({
|
|
1488
1637
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALL_ENDPOINT_RESOURCE}`,
|
|
1489
1638
|
method: HTTP_METHODS.POST,
|
|
1490
1639
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1508,7 +1657,7 @@ export class Call extends Eventing {
|
|
|
1508
1657
|
file: CALL_FILE,
|
|
1509
1658
|
method: 'patch',
|
|
1510
1659
|
});
|
|
1511
|
-
return this.
|
|
1660
|
+
return this.apiRequest.makeRequest({
|
|
1512
1661
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}`,
|
|
1513
1662
|
method: HTTP_METHODS.PATCH,
|
|
1514
1663
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1573,10 +1722,10 @@ export class Call extends Eventing {
|
|
|
1573
1722
|
});
|
|
1574
1723
|
}
|
|
1575
1724
|
}
|
|
1576
|
-
return this.
|
|
1725
|
+
return this.apiRequest.makeRequest(request);
|
|
1577
1726
|
}
|
|
1578
1727
|
async postStatus() {
|
|
1579
|
-
return this.
|
|
1728
|
+
return this.apiRequest.makeRequest({
|
|
1580
1729
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}/${CALL_STATUS_RESOURCE}`,
|
|
1581
1730
|
method: HTTP_METHODS.POST,
|
|
1582
1731
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1687,7 +1836,7 @@ export class Call extends Eventing {
|
|
|
1687
1836
|
file: CALL_FILE,
|
|
1688
1837
|
method: METHODS.POST_MEDIA,
|
|
1689
1838
|
});
|
|
1690
|
-
return this.
|
|
1839
|
+
return this.apiRequest.makeRequest({
|
|
1691
1840
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}/${MEDIA_ENDPOINT_RESOURCE}`,
|
|
1692
1841
|
method: HTTP_METHODS.POST,
|
|
1693
1842
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1709,61 +1858,29 @@ export class Call extends Eventing {
|
|
|
1709
1858
|
});
|
|
1710
1859
|
}
|
|
1711
1860
|
mediaRoapEventsListener() {
|
|
1712
|
-
this.mediaConnection.on(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND,
|
|
1713
|
-
|
|
1714
|
-
\n type: ${event.roapMessage?.messageType}, seq: ${event.roapMessage.seq} , version: ${event.roapMessage.version}`, { file: CALL_FILE, method: METHODS.MEDIA_ROAP_EVENTS_LISTENER });
|
|
1715
|
-
log.info(`SDP message to send : \n ${event.roapMessage?.sdp}`, {
|
|
1716
|
-
file: CALL_FILE,
|
|
1717
|
-
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
1718
|
-
});
|
|
1719
|
-
switch (event.roapMessage.messageType) {
|
|
1720
|
-
case RoapScenario.OK: {
|
|
1721
|
-
const mediaOk = {
|
|
1722
|
-
received: false,
|
|
1723
|
-
message: event.roapMessage,
|
|
1724
|
-
};
|
|
1725
|
-
this.sendMediaStateMachineEvt({ type: 'E_ROAP_OK', data: mediaOk });
|
|
1726
|
-
break;
|
|
1727
|
-
}
|
|
1728
|
-
case RoapScenario.OFFER: {
|
|
1729
|
-
log.info(`before modifying sdp: ${event.roapMessage.sdp}`, {
|
|
1730
|
-
file: CALL_FILE,
|
|
1731
|
-
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
1732
|
-
});
|
|
1733
|
-
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
1734
|
-
const sdpVideoPortZero = event.roapMessage.sdp.replace(/^m=(video) (?:\d+) /gim, 'm=$1 0 ');
|
|
1735
|
-
log.info(`after modification sdp: ${sdpVideoPortZero}`, {
|
|
1736
|
-
file: CALL_FILE,
|
|
1737
|
-
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
1738
|
-
});
|
|
1739
|
-
event.roapMessage.sdp = sdpVideoPortZero;
|
|
1740
|
-
this.localRoapMessage = event.roapMessage;
|
|
1741
|
-
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_SETUP', data: event.roapMessage });
|
|
1742
|
-
break;
|
|
1743
|
-
}
|
|
1744
|
-
case RoapScenario.ANSWER:
|
|
1745
|
-
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
1746
|
-
this.localRoapMessage = event.roapMessage;
|
|
1747
|
-
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_ANSWER', data: event.roapMessage });
|
|
1748
|
-
break;
|
|
1749
|
-
case RoapScenario.ERROR:
|
|
1750
|
-
this.sendMediaStateMachineEvt({ type: 'E_ROAP_ERROR', data: event.roapMessage });
|
|
1751
|
-
break;
|
|
1752
|
-
case RoapScenario.OFFER_RESPONSE:
|
|
1753
|
-
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
1754
|
-
this.localRoapMessage = event.roapMessage;
|
|
1755
|
-
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_OFFER', data: event.roapMessage });
|
|
1756
|
-
break;
|
|
1757
|
-
default:
|
|
1758
|
-
}
|
|
1759
|
-
});
|
|
1861
|
+
this.mediaConnection.on(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, this.handleMediaRoapEvent);
|
|
1862
|
+
this.mediaConnection.on(MediaConnectionEventNames.ROAP_FAILURE, this.handleRoapFailure);
|
|
1760
1863
|
}
|
|
1761
1864
|
mediaTrackListener() {
|
|
1762
|
-
this.mediaConnection.on(MediaConnectionEventNames.REMOTE_TRACK_ADDED,
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1865
|
+
this.mediaConnection.on(MediaConnectionEventNames.REMOTE_TRACK_ADDED, this.handleRemoteTrackAdded);
|
|
1866
|
+
}
|
|
1867
|
+
mediaIceEventsListener() {
|
|
1868
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, this.handleIceGatheringStateChanged);
|
|
1869
|
+
this.mediaConnection.on(MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, this.handlePeerConnectionStateChanged);
|
|
1870
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, this.handleIceConnectionStateChanged);
|
|
1871
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_CANDIDATE_ERROR, this.handleIceCandidateError);
|
|
1872
|
+
}
|
|
1873
|
+
unregisterMediaConnectionListeners() {
|
|
1874
|
+
if (!this.mediaConnection || typeof this.mediaConnection.off !== 'function') {
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
this.mediaConnection.off(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, this.handleMediaRoapEvent);
|
|
1878
|
+
this.mediaConnection.off(MediaConnectionEventNames.ROAP_FAILURE, this.handleRoapFailure);
|
|
1879
|
+
this.mediaConnection.off(MediaConnectionEventNames.REMOTE_TRACK_ADDED, this.handleRemoteTrackAdded);
|
|
1880
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, this.handleIceGatheringStateChanged);
|
|
1881
|
+
this.mediaConnection.off(MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, this.handlePeerConnectionStateChanged);
|
|
1882
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, this.handleIceConnectionStateChanged);
|
|
1883
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_CANDIDATE_ERROR, this.handleIceCandidateError);
|
|
1767
1884
|
}
|
|
1768
1885
|
onEffectEnabled = () => {
|
|
1769
1886
|
this.metricManager.submitBNRMetric(METRIC_EVENT.BNR_ENABLED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId);
|
|
@@ -1808,7 +1925,7 @@ export class Call extends Eventing {
|
|
|
1808
1925
|
}
|
|
1809
1926
|
async delete() {
|
|
1810
1927
|
const disconnectMetrics = await this.getCallStats();
|
|
1811
|
-
return this.
|
|
1928
|
+
return this.apiRequest.makeRequest({
|
|
1812
1929
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}`,
|
|
1813
1930
|
method: HTTP_METHODS.DELETE,
|
|
1814
1931
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1833,7 +1950,7 @@ export class Call extends Eventing {
|
|
|
1833
1950
|
this.metricManager.submitCallMetric(METRIC_EVENT.CALL_ERROR, transferMetricAction || this.callStateMachine.state.value.toString(), METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, error);
|
|
1834
1951
|
}
|
|
1835
1952
|
else {
|
|
1836
|
-
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA_ERROR, this.mediaStateMachine.state.value.toString(), METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, this.localRoapMessage.sdp, this.remoteRoapMessage?.sdp, error);
|
|
1953
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA_ERROR, this.mediaStateMachine.state.value.toString(), METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, this.localRoapMessage.sdp, this.remoteRoapMessage?.sdp, undefined, error);
|
|
1837
1954
|
}
|
|
1838
1955
|
}
|
|
1839
1956
|
handleMidCallEvent(event) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APIRequest } from '../utils/request';
|
|
1
2
|
import { METHOD_START_MESSAGE } from '../../common/constants';
|
|
2
3
|
import { CALL_MANAGER_FILE, METHODS } from '../constants';
|
|
3
4
|
import { CALLING_CLIENT_EVENT_KEYS, LINE_EVENT_KEYS } from '../../Events/types';
|
|
@@ -15,6 +16,8 @@ export class CallManager extends Eventing {
|
|
|
15
16
|
activeMobiusUrl;
|
|
16
17
|
serviceIndicator;
|
|
17
18
|
lineDict;
|
|
19
|
+
apiRequest;
|
|
20
|
+
isMobiusSocketListenerRegistered = false;
|
|
18
21
|
constructor(webex, indicator) {
|
|
19
22
|
super();
|
|
20
23
|
this.sdkConnector = SDKConnector;
|
|
@@ -24,6 +27,7 @@ export class CallManager extends Eventing {
|
|
|
24
27
|
}
|
|
25
28
|
this.lineDict = {};
|
|
26
29
|
this.webex = this.sdkConnector.getWebex();
|
|
30
|
+
this.apiRequest = APIRequest.getInstance({ webex: this.webex });
|
|
27
31
|
this.callCollection = {};
|
|
28
32
|
this.activeMobiusUrl = '';
|
|
29
33
|
this.listenForWsEvents();
|
|
@@ -57,15 +61,28 @@ export class CallManager extends Eventing {
|
|
|
57
61
|
file: CALL_MANAGER_FILE,
|
|
58
62
|
method: METHODS.UPDATE_ACTIVE_MOBIUS,
|
|
59
63
|
});
|
|
64
|
+
this.listenForWsEvents();
|
|
60
65
|
}
|
|
61
66
|
listenForWsEvents() {
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const socketEnabled = this.apiRequest.isSocketEnabled();
|
|
68
|
+
if (!socketEnabled && !this.isMobiusSocketListenerRegistered) {
|
|
69
|
+
this.sdkConnector.registerListener('event:mobius', async (event) => {
|
|
70
|
+
this.dequeueWsEvents(event);
|
|
71
|
+
});
|
|
72
|
+
this.isMobiusSocketListenerRegistered = true;
|
|
73
|
+
log.info('Successfully registered listener for Mobius events', {
|
|
74
|
+
file: CALL_MANAGER_FILE,
|
|
75
|
+
method: METHODS.REGISTER_SESSIONS_LISTENER,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else if (socketEnabled && this.isMobiusSocketListenerRegistered) {
|
|
79
|
+
this.sdkConnector.unregisterListener('event:mobius');
|
|
80
|
+
this.isMobiusSocketListenerRegistered = false;
|
|
81
|
+
log.info('Unregistered Mercury listener for Mobius events; using WebSocket transport', {
|
|
82
|
+
file: CALL_MANAGER_FILE,
|
|
83
|
+
method: METHODS.REGISTER_SESSIONS_LISTENER,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
69
86
|
}
|
|
70
87
|
dequeueWsEvents(event) {
|
|
71
88
|
log.info(`${METHOD_START_MESSAGE} with event ${event}`, {
|
|
@@ -137,9 +154,31 @@ export class CallManager extends Eventing {
|
|
|
137
154
|
method: METHODS.DEQUEUE_WS_EVENTS,
|
|
138
155
|
});
|
|
139
156
|
const call = this.getCall(correlationId);
|
|
157
|
+
if (mobiusEvent.data.callerId) {
|
|
158
|
+
log.info('Processing Caller-Id data', {
|
|
159
|
+
file: CALL_MANAGER_FILE,
|
|
160
|
+
method: METHODS.DEQUEUE_WS_EVENTS,
|
|
161
|
+
});
|
|
162
|
+
call.startCallerIdResolution(mobiusEvent.data.callerId);
|
|
163
|
+
}
|
|
140
164
|
call.sendCallStateMachineEvt({ type: 'E_RECV_CALL_PROGRESS', data: mobiusEvent.data });
|
|
141
165
|
break;
|
|
142
166
|
}
|
|
167
|
+
case MobiusEventType.CALL_INFO: {
|
|
168
|
+
log.log(`Received call info mobiusEvent for call: ${correlationId}`, {
|
|
169
|
+
file: CALL_MANAGER_FILE,
|
|
170
|
+
method: METHODS.DEQUEUE_WS_EVENTS,
|
|
171
|
+
});
|
|
172
|
+
const call = this.getCall(correlationId);
|
|
173
|
+
if (call && mobiusEvent.data.callerId) {
|
|
174
|
+
log.info('Processing Caller-Id data', {
|
|
175
|
+
file: CALL_MANAGER_FILE,
|
|
176
|
+
method: METHODS.DEQUEUE_WS_EVENTS,
|
|
177
|
+
});
|
|
178
|
+
call.startCallerIdResolution(mobiusEvent.data.callerId);
|
|
179
|
+
}
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
143
182
|
case MobiusEventType.CALL_MEDIA: {
|
|
144
183
|
log.log(`Received call media mobiusEvent for call: ${correlationId}`, {
|
|
145
184
|
file: CALL_MANAGER_FILE,
|
|
@@ -5,6 +5,8 @@ export var MobiusEventType;
|
|
|
5
5
|
MobiusEventType["CALL_CONNECTED"] = "mobius.callconnected";
|
|
6
6
|
MobiusEventType["CALL_MEDIA"] = "mobius.media";
|
|
7
7
|
MobiusEventType["CALL_DISCONNECTED"] = "mobius.calldisconnected";
|
|
8
|
+
MobiusEventType["CALL_INFO"] = "mobius.callinfo";
|
|
9
|
+
MobiusEventType["REGISTRATION_DOWN"] = "registration.down";
|
|
8
10
|
})(MobiusEventType || (MobiusEventType = {}));
|
|
9
11
|
export var MediaState;
|
|
10
12
|
(function (MediaState) {
|
|
@@ -69,6 +69,9 @@ export const CALL_FILE = 'call';
|
|
|
69
69
|
export const CALL_MANAGER_FILE = 'callManager';
|
|
70
70
|
export const METRIC_FILE = 'metric';
|
|
71
71
|
export const REGISTRATION_FILE = 'register';
|
|
72
|
+
export const REQUEST_FILE = 'REQUEST';
|
|
73
|
+
export const MOBIUS_SOCKET_MAPPER_FILE = 'mobiusSocketMapper';
|
|
74
|
+
export const WS_FEATURE_FLAG_FILE = 'wsFeatureFlag';
|
|
72
75
|
export const CODEC_ID = 'codecId';
|
|
73
76
|
export const MEDIA_ID = 'id';
|
|
74
77
|
export const RTC_ICE_CANDIDATE_PAIR = 'RTCIceCandidatePair_';
|
|
@@ -125,7 +128,9 @@ export const MOBIUS_EU_PROD = 'mobius-eu-central-1.prod.infra.webex.com';
|
|
|
125
128
|
export const MOBIUS_US_INT = 'mobius-us-east-1.int.infra.webex.com';
|
|
126
129
|
export const MOBIUS_EU_INT = 'mobius-eu-central-1.int.infra.webex.com';
|
|
127
130
|
export const FAILOVER_CACHE_PREFIX = 'wxc-failover-state';
|
|
131
|
+
export const ACTIVE_MOBIUS_STORAGE_KEY = 'wxc-active-mobius';
|
|
128
132
|
export const ICE_CANDIDATES_TIMEOUT = 3000;
|
|
133
|
+
export const WCC_CALLING_RTMS_DOMAIN = 'wcc-calling-rtms-domain';
|
|
129
134
|
export const METHODS = {
|
|
130
135
|
CONSTRUCTOR: 'constructor',
|
|
131
136
|
CREATE_CALL: 'createCall',
|
|
@@ -178,6 +183,7 @@ export const METHODS = {
|
|
|
178
183
|
POST_MEDIA: 'postMedia',
|
|
179
184
|
MEDIA_ROAP_EVENTS_LISTENER: 'mediaRoapEventsListener',
|
|
180
185
|
MEDIA_TRACK_LISTENER: 'mediaTrackListener',
|
|
186
|
+
MEDIA_ICE_EVENTS_LISTENER: 'mediaIceEventsListener',
|
|
181
187
|
ON_EFFECT_ENABLED: 'onEffectEnabled',
|
|
182
188
|
ON_EFFECT_DISABLED: 'onEffectDisabled',
|
|
183
189
|
UPDATE_TRACK: 'updateTrack',
|
|
@@ -225,7 +231,27 @@ export const METHODS = {
|
|
|
225
231
|
REGISTER_SESSIONS_LISTENER: 'registerSessionsListener',
|
|
226
232
|
CREATE_LINE: 'createLine',
|
|
227
233
|
GET_LINES: 'getLines',
|
|
234
|
+
GET_DEVICES: 'getDevices',
|
|
228
235
|
UPLOAD_LOGS: 'uploadLogs',
|
|
229
236
|
GET_SDK_CONNECTOR: 'getSDKConnector',
|
|
230
237
|
GET_CONNECTED_CALL: 'getConnectedCall',
|
|
238
|
+
CONNECT_TO_MOBIUS_SOCKET: 'connectToMobiusSocket',
|
|
239
|
+
SET_SOCKET_ENABLED: 'setSocketEnabled',
|
|
240
|
+
REGISTER_MOBIUS_SOCKET_LISTENER: 'registerMobiusSocketListener',
|
|
241
|
+
UNREGISTER_MOBIUS_SOCKET_LISTENER: 'unregisterMobiusSocketListener',
|
|
242
|
+
REGISTER_MOBIUS_SOCKET_CONNECTION_LISTENER: 'registerMobiusSocketConnectionListener',
|
|
243
|
+
UNREGISTER_MOBIUS_SOCKET_CONNECTION_LISTENER: 'unregisterMobiusSocketConnectionListener',
|
|
244
|
+
HANDLE_MOBIUS_ASYNC_EVENT: 'handleMobiusAsyncEvent',
|
|
245
|
+
HANDLE_REGISTRATION_DOWN_EVENT: 'handleRegistrationDownEvent',
|
|
246
|
+
DISCONNECT_FROM_MOBIUS_SOCKET: 'disconnectFromMobiusSocket',
|
|
247
|
+
MAKE_REQUEST: 'makeRequest',
|
|
248
|
+
DERIVE_MOBIUS_SOCKET_MESSAGE_TYPE: 'deriveMobiusSocketMessageType',
|
|
249
|
+
IS_MOBIUS_WSS_ENABLED: 'isMobiusWssEnabled',
|
|
250
|
+
RESTORE_PREVIOUS_REGISTRATION: 'restorePreviousRegistration',
|
|
251
|
+
RESTART_REGISTRATION: 'restartRegistration',
|
|
252
|
+
TRIGGER_REGISTRATION: 'triggerRegistration',
|
|
253
|
+
HANDLE_404_KEEPALIVE_FAILURE: 'handle404KeepaliveFailure',
|
|
254
|
+
INITIATE_FAILBACK: 'initiateFailback',
|
|
255
|
+
EXECUTE_FAILBACK: 'executeFailback',
|
|
256
|
+
GET_RTMS_DOMAIN: 'getRTMSDomain',
|
|
231
257
|
};
|
|
@@ -70,12 +70,12 @@ export default class Line extends Eventing {
|
|
|
70
70
|
await this.registration.triggerRegistration();
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
async deregister() {
|
|
73
|
+
async deregister(closeMobiusWss = false) {
|
|
74
74
|
log.info(METHOD_START_MESSAGE, {
|
|
75
75
|
file: LINE_FILE,
|
|
76
76
|
method: METHODS.DEREGISTER,
|
|
77
77
|
});
|
|
78
|
-
await this.registration.deregister();
|
|
78
|
+
await this.registration.deregister(closeMobiusWss);
|
|
79
79
|
this.registration.setStatus(RegistrationStatus.IDLE);
|
|
80
80
|
}
|
|
81
81
|
normalizeLine(deviceInfo) {
|