@webex/calling 3.12.0-next.9 → 3.12.0-next.91
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/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 +456 -226
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +513 -154
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +634 -454
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +809 -451
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +106 -35
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +140 -0
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/types.js +5 -0
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/constants.js +32 -3
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +8 -1
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +62 -10
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +890 -497
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +649 -58
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js +26 -0
- 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 +7 -0
- 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/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/types.js +38 -1
- 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 +212 -71
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +417 -181
- 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 +171 -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/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 +126 -10
- package/dist/module/CallingClient/calling/call.js +198 -66
- package/dist/module/CallingClient/calling/callManager.js +51 -11
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +27 -0
- package/dist/module/CallingClient/line/index.js +4 -2
- package/dist/module/CallingClient/registration/register.js +266 -64
- package/dist/module/CallingClient/registration/types.js +5 -1
- 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/Errors/types.js +2 -0
- package/dist/module/Events/types.js +23 -0
- 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 +85 -22
- 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/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 +8 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +17 -3
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +8 -4
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +38 -9
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +27 -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 +8 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +27 -2
- 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 +4 -2
- 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/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +80 -6
- 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 +9 -4
- 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 +5 -1
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +9 -4
- 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 +21 -5
- package/src/mobius-socket/socket/socket.shim.ts +22 -0
- package/src/mobius-socket/socket/socket.ts +14 -0
|
@@ -7,16 +7,17 @@ import { ERROR_LAYER, ERROR_TYPE } from '../../Errors/types';
|
|
|
7
7
|
import { handleCallErrors, modifySdpForIPv4, parseMediaQualityStatistics, serviceErrorCodeHandler, uploadLogs, } from '../../common/Utils';
|
|
8
8
|
import { ALLOWED_SERVICES, CallDirection, HTTP_METHODS, } from '../../common/types';
|
|
9
9
|
import { createCallError } from '../../Errors/catalog/CallError';
|
|
10
|
-
import { CALL_ENDPOINT_RESOURCE, CALL_FILE, CALL_HOLD_SERVICE, CALL_STATUS_RESOURCE, CALL_TRANSFER_SERVICE, CALLING_USER_AGENT, CALLS_ENDPOINT_RESOURCE, CISCO_DEVICE_URL, DEFAULT_LOCAL_CALL_ID, DEFAULT_SESSION_TIMER, DEVICES_ENDPOINT_RESOURCE, HOLD_ENDPOINT, ICE_CANDIDATES_TIMEOUT, INITIAL_SEQ_NUMBER, MAX_CALL_KEEPALIVE_RETRY_COUNT, MEDIA_ENDPOINT_RESOURCE, METHODS, NOISE_REDUCTION_EFFECT, RESUME_ENDPOINT, SPARK_USER_AGENT, SUPPLEMENTARY_SERVICES_TIMEOUT, TRANSFER_ENDPOINT, } from '../constants';
|
|
10
|
+
import { CALL_ENDPOINT_RESOURCE, CALL_FILE, CALL_HOLD_SERVICE, CALL_STATUS_RESOURCE, CALL_TRANSFER_SERVICE, CALLING_USER_AGENT, CALLS_ENDPOINT_RESOURCE, CISCO_DEVICE_URL, DEFAULT_LOCAL_CALL_ID, DEFAULT_SESSION_TIMER, DEVICES_ENDPOINT_RESOURCE, HOLD_ENDPOINT, ICE_CANDIDATES_TIMEOUT, ICE_LITE_CANDIDATES_TIMEOUT, INITIAL_SEQ_NUMBER, MAX_CALL_KEEPALIVE_RETRY_COUNT, MEDIA_ENDPOINT_RESOURCE, METHODS, NOISE_REDUCTION_EFFECT, RESUME_ENDPOINT, SPARK_USER_AGENT, SUPPLEMENTARY_SERVICES_TIMEOUT, TRANSFER_ENDPOINT, } from '../constants';
|
|
11
11
|
import SDKConnector from '../../SDKConnector';
|
|
12
12
|
import { Eventing } from '../../Events/impl';
|
|
13
13
|
import { CALL_EVENT_KEYS, MEDIA_CONNECTION_EVENT_KEYS, MOBIUS_MIDCALL_STATE, SUPPLEMENTARY_SERVICES, } from '../../Events/types';
|
|
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,144 @@ 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
|
+
iceGatheringConfig;
|
|
59
|
+
handleMediaRoapEvent = async (event) => {
|
|
60
|
+
log.info(`ROAP message to send (rcv from MEDIA-SDK) :
|
|
61
|
+
\n type: ${event.roapMessage?.messageType}, seq: ${event.roapMessage.seq} , version: ${event.roapMessage.version}`, { file: CALL_FILE, method: METHODS.MEDIA_ROAP_EVENTS_LISTENER });
|
|
62
|
+
log.info(`SDP message to send : \n ${event.roapMessage?.sdp}`, {
|
|
63
|
+
file: CALL_FILE,
|
|
64
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
65
|
+
});
|
|
66
|
+
switch (event.roapMessage.messageType) {
|
|
67
|
+
case RoapScenario.OK: {
|
|
68
|
+
const mediaOk = {
|
|
69
|
+
received: false,
|
|
70
|
+
message: event.roapMessage,
|
|
71
|
+
};
|
|
72
|
+
this.sendMediaStateMachineEvt({ type: 'E_ROAP_OK', data: mediaOk });
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case RoapScenario.OFFER: {
|
|
76
|
+
if (!event.roapMessage.sdp) {
|
|
77
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
78
|
+
file: CALL_FILE,
|
|
79
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
80
|
+
});
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
log.info(`before modifying sdp: ${event.roapMessage.sdp}`, {
|
|
84
|
+
file: CALL_FILE,
|
|
85
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
86
|
+
});
|
|
87
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
88
|
+
const sdpVideoPortZero = event.roapMessage.sdp.replace(/^m=(video) (?:\d+) /gim, 'm=$1 0 ');
|
|
89
|
+
log.info(`after modification sdp: ${sdpVideoPortZero}`, {
|
|
90
|
+
file: CALL_FILE,
|
|
91
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
92
|
+
});
|
|
93
|
+
event.roapMessage.sdp = sdpVideoPortZero;
|
|
94
|
+
this.localRoapMessage = event.roapMessage;
|
|
95
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_SETUP', data: event.roapMessage });
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case RoapScenario.ANSWER:
|
|
99
|
+
if (!event.roapMessage.sdp) {
|
|
100
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
101
|
+
file: CALL_FILE,
|
|
102
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
103
|
+
});
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
107
|
+
this.localRoapMessage = event.roapMessage;
|
|
108
|
+
if (this.connectPending) {
|
|
109
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_CONNECT' });
|
|
110
|
+
}
|
|
111
|
+
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_ANSWER', data: event.roapMessage });
|
|
112
|
+
break;
|
|
113
|
+
case RoapScenario.ERROR:
|
|
114
|
+
this.sendMediaStateMachineEvt({ type: 'E_ROAP_ERROR', data: event.roapMessage });
|
|
115
|
+
break;
|
|
116
|
+
case RoapScenario.OFFER_RESPONSE:
|
|
117
|
+
if (!event.roapMessage.sdp) {
|
|
118
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
119
|
+
file: CALL_FILE,
|
|
120
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
121
|
+
});
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
125
|
+
this.localRoapMessage = event.roapMessage;
|
|
126
|
+
if (this.connectPending) {
|
|
127
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_CONNECT' });
|
|
128
|
+
}
|
|
129
|
+
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_OFFER', data: event.roapMessage });
|
|
130
|
+
break;
|
|
131
|
+
default:
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
handleRemoteTrackAdded = (event) => {
|
|
135
|
+
if (event.type === MEDIA_CONNECTION_EVENT_KEYS.MEDIA_TYPE_AUDIO) {
|
|
136
|
+
this.emit(CALL_EVENT_KEYS.REMOTE_MEDIA, event.track);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
static getPeerConnectionStateFromEvent(event, preferredKey) {
|
|
140
|
+
return event[preferredKey] || event.state || 'unknown';
|
|
141
|
+
}
|
|
142
|
+
handleIceGatheringStateChanged = (event) => {
|
|
143
|
+
const iceGatheringState = Call.getPeerConnectionStateFromEvent(event, 'iceGatheringState');
|
|
144
|
+
log.info(`ICE gathering state changed to: ${iceGatheringState}`, {
|
|
145
|
+
file: CALL_FILE,
|
|
146
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
147
|
+
});
|
|
148
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.ICE_GATHERING_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, iceGatheringState);
|
|
149
|
+
};
|
|
150
|
+
handlePeerConnectionStateChanged = (event) => {
|
|
151
|
+
const connectionState = Call.getPeerConnectionStateFromEvent(event, 'connectionState');
|
|
152
|
+
log.info(`Peer connection state changed to: ${connectionState}`, {
|
|
153
|
+
file: CALL_FILE,
|
|
154
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
155
|
+
});
|
|
156
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.PEER_CONNECTION_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, connectionState);
|
|
157
|
+
};
|
|
158
|
+
handleIceConnectionStateChanged = (event) => {
|
|
159
|
+
const iceConnectionState = Call.getPeerConnectionStateFromEvent(event, 'iceConnectionState');
|
|
160
|
+
log.info(`ICE connection state changed to: ${iceConnectionState}`, {
|
|
161
|
+
file: CALL_FILE,
|
|
162
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
163
|
+
});
|
|
164
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.ICE_CONNECTION_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, iceConnectionState);
|
|
165
|
+
};
|
|
166
|
+
handleIceCandidateError = (event) => {
|
|
167
|
+
const iceErrorPayload = {
|
|
168
|
+
address: event.address ?? null,
|
|
169
|
+
errorCode: event.errorCode,
|
|
170
|
+
errorText: event.errorText,
|
|
171
|
+
port: event.port ?? null,
|
|
172
|
+
url: event.url,
|
|
173
|
+
};
|
|
174
|
+
log.warn(`ICE candidate error occurred: ${JSON.stringify(iceErrorPayload)}`, {
|
|
175
|
+
file: CALL_FILE,
|
|
176
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
177
|
+
});
|
|
178
|
+
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);
|
|
179
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA_ERROR, MEDIA_CONNECTION_ACTION.ICE_CANDIDATE_ERROR, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, undefined, callError);
|
|
180
|
+
};
|
|
181
|
+
handleRoapFailure = (error) => {
|
|
182
|
+
const failureMessage = error.message || 'Unknown ROAP failure received from media SDK';
|
|
183
|
+
log.warn(`ROAP failure occurred: ${failureMessage}`, {
|
|
184
|
+
file: CALL_FILE,
|
|
185
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
186
|
+
});
|
|
187
|
+
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);
|
|
188
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA_ERROR, MEDIA_CONNECTION_ACTION.ROAP_FAILURE, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, undefined, callError);
|
|
189
|
+
};
|
|
55
190
|
isMuted() {
|
|
56
191
|
return this.muted;
|
|
57
192
|
}
|
|
@@ -61,7 +196,7 @@ export class Call extends Eventing {
|
|
|
61
196
|
isHeld() {
|
|
62
197
|
return this.held;
|
|
63
198
|
}
|
|
64
|
-
constructor(activeUrl, webex, direction, deviceId, lineId, deleteCb, indicator, destination) {
|
|
199
|
+
constructor(activeUrl, webex, direction, deviceId, lineId, deleteCb, indicator, destination, iceGatheringConfig) {
|
|
65
200
|
super();
|
|
66
201
|
this.destination = destination;
|
|
67
202
|
this.direction = direction;
|
|
@@ -69,6 +204,7 @@ export class Call extends Eventing {
|
|
|
69
204
|
this.deviceId = deviceId;
|
|
70
205
|
this.serviceIndicator = indicator;
|
|
71
206
|
this.lineId = lineId;
|
|
207
|
+
this.iceGatheringConfig = iceGatheringConfig;
|
|
72
208
|
if (!this.sdkConnector.getWebex()) {
|
|
73
209
|
SDKConnector.setWebex(webex);
|
|
74
210
|
}
|
|
@@ -86,6 +222,7 @@ export class Call extends Eventing {
|
|
|
86
222
|
this.mobiusUrl = activeUrl;
|
|
87
223
|
this.receivedRoapOKSeq = 0;
|
|
88
224
|
this.mediaNegotiationCompleted = false;
|
|
225
|
+
this.connectPending = false;
|
|
89
226
|
log.info(`Webex Calling Url:- ${this.mobiusUrl}`, {
|
|
90
227
|
file: CALL_FILE,
|
|
91
228
|
method: METHODS.CONSTRUCTOR,
|
|
@@ -102,6 +239,7 @@ export class Call extends Eventing {
|
|
|
102
239
|
this.remoteRoapMessage = null;
|
|
103
240
|
this.disconnectReason = { code: DisconnectCode.NORMAL, cause: DisconnectCause.NORMAL };
|
|
104
241
|
this.rtcMetrics = new RtcMetrics(this.webex, { callId: this.callId }, this.correlationId);
|
|
242
|
+
this.apiRequest = APIRequest.getInstance({ webex: this.webex });
|
|
105
243
|
const callMachine = createMachine({
|
|
106
244
|
schema: {
|
|
107
245
|
context: {},
|
|
@@ -281,6 +419,11 @@ export class Call extends Eventing {
|
|
|
281
419
|
},
|
|
282
420
|
},
|
|
283
421
|
on: {
|
|
422
|
+
E_SEND_CALL_CONNECT: {
|
|
423
|
+
cond: () => this.connectPending,
|
|
424
|
+
target: 'S_SEND_CALL_CONNECT',
|
|
425
|
+
actions: ['outgoingCallConnect'],
|
|
426
|
+
},
|
|
284
427
|
E_CALL_ESTABLISHED: {
|
|
285
428
|
target: 'S_CALL_ESTABLISHED',
|
|
286
429
|
actions: ['callEstablished'],
|
|
@@ -842,6 +985,7 @@ export class Call extends Eventing {
|
|
|
842
985
|
}
|
|
843
986
|
}
|
|
844
987
|
async handleOutgoingCallConnect(event) {
|
|
988
|
+
this.connectPending = false;
|
|
845
989
|
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
|
|
846
990
|
file: CALL_FILE,
|
|
847
991
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
@@ -851,6 +995,7 @@ export class Call extends Eventing {
|
|
|
851
995
|
file: CALL_FILE,
|
|
852
996
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
853
997
|
});
|
|
998
|
+
this.connectPending = true;
|
|
854
999
|
return;
|
|
855
1000
|
}
|
|
856
1001
|
try {
|
|
@@ -910,6 +1055,7 @@ export class Call extends Eventing {
|
|
|
910
1055
|
clearInterval(this.sessionTimer);
|
|
911
1056
|
}
|
|
912
1057
|
if (this.mediaConnection) {
|
|
1058
|
+
this.unregisterMediaConnectionListeners();
|
|
913
1059
|
this.mediaConnection.close();
|
|
914
1060
|
log.info('Closing media channel', {
|
|
915
1061
|
file: CALL_FILE,
|
|
@@ -953,6 +1099,7 @@ export class Call extends Eventing {
|
|
|
953
1099
|
clearInterval(this.sessionTimer);
|
|
954
1100
|
}
|
|
955
1101
|
if (this.mediaConnection) {
|
|
1102
|
+
this.unregisterMediaConnectionListeners();
|
|
956
1103
|
this.mediaConnection.close();
|
|
957
1104
|
log.info('Closing media channel', {
|
|
958
1105
|
file: CALL_FILE,
|
|
@@ -1064,6 +1211,7 @@ export class Call extends Eventing {
|
|
|
1064
1211
|
clearInterval(this.sessionTimer);
|
|
1065
1212
|
}
|
|
1066
1213
|
if (this.mediaConnection) {
|
|
1214
|
+
this.unregisterMediaConnectionListeners();
|
|
1067
1215
|
this.mediaConnection.close();
|
|
1068
1216
|
log.info('Closing media channel', {
|
|
1069
1217
|
file: CALL_FILE,
|
|
@@ -1358,11 +1506,25 @@ export class Call extends Eventing {
|
|
|
1358
1506
|
});
|
|
1359
1507
|
}
|
|
1360
1508
|
};
|
|
1509
|
+
getIceCandidatesTimeout() {
|
|
1510
|
+
if (!this.iceGatheringConfig?.reduceTimeoutForIceLite) {
|
|
1511
|
+
return ICE_CANDIDATES_TIMEOUT;
|
|
1512
|
+
}
|
|
1513
|
+
const remoteSdp = this.remoteRoapMessage?.sdp;
|
|
1514
|
+
if (remoteSdp && /^a=ice-lite[\r\n]*$/im.test(remoteSdp)) {
|
|
1515
|
+
log.info('Remote offer advertises ice-lite, using reduced ICE candidates timeout', {
|
|
1516
|
+
file: CALL_FILE,
|
|
1517
|
+
method: METHODS.INIT_MEDIA_CONNECTION,
|
|
1518
|
+
});
|
|
1519
|
+
return this.iceGatheringConfig.iceLiteTimeout ?? ICE_LITE_CANDIDATES_TIMEOUT;
|
|
1520
|
+
}
|
|
1521
|
+
return ICE_CANDIDATES_TIMEOUT;
|
|
1522
|
+
}
|
|
1361
1523
|
initMediaConnection(localAudioTrack, debugId) {
|
|
1362
1524
|
const mediaConnection = new RoapMediaConnection({
|
|
1363
1525
|
skipInactiveTransceivers: true,
|
|
1364
1526
|
iceServers: [],
|
|
1365
|
-
iceCandidatesTimeout:
|
|
1527
|
+
iceCandidatesTimeout: this.getIceCandidatesTimeout(),
|
|
1366
1528
|
sdpMunging: {
|
|
1367
1529
|
convertPort9to0: true,
|
|
1368
1530
|
addContentSlides: false,
|
|
@@ -1435,6 +1597,7 @@ export class Call extends Eventing {
|
|
|
1435
1597
|
this.initMediaConnection(localAudioTrack);
|
|
1436
1598
|
this.mediaRoapEventsListener();
|
|
1437
1599
|
this.mediaTrackListener();
|
|
1600
|
+
this.mediaIceEventsListener();
|
|
1438
1601
|
this.registerListeners(localAudioStream);
|
|
1439
1602
|
}
|
|
1440
1603
|
if (this.callStateMachine.state.value === 'S_SEND_CALL_PROGRESS') {
|
|
@@ -1465,6 +1628,7 @@ export class Call extends Eventing {
|
|
|
1465
1628
|
this.initMediaConnection(localAudioTrack);
|
|
1466
1629
|
this.mediaRoapEventsListener();
|
|
1467
1630
|
this.mediaTrackListener();
|
|
1631
|
+
this.mediaIceEventsListener();
|
|
1468
1632
|
this.registerListeners(localAudioStream);
|
|
1469
1633
|
}
|
|
1470
1634
|
if (this.mediaStateMachine.state.value === 'S_ROAP_IDLE') {
|
|
@@ -1485,7 +1649,7 @@ export class Call extends Eventing {
|
|
|
1485
1649
|
mediaId: uuid(),
|
|
1486
1650
|
},
|
|
1487
1651
|
};
|
|
1488
|
-
return this.
|
|
1652
|
+
return this.apiRequest.makeRequest({
|
|
1489
1653
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALL_ENDPOINT_RESOURCE}`,
|
|
1490
1654
|
method: HTTP_METHODS.POST,
|
|
1491
1655
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1509,7 +1673,7 @@ export class Call extends Eventing {
|
|
|
1509
1673
|
file: CALL_FILE,
|
|
1510
1674
|
method: 'patch',
|
|
1511
1675
|
});
|
|
1512
|
-
return this.
|
|
1676
|
+
return this.apiRequest.makeRequest({
|
|
1513
1677
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}`,
|
|
1514
1678
|
method: HTTP_METHODS.PATCH,
|
|
1515
1679
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1574,10 +1738,10 @@ export class Call extends Eventing {
|
|
|
1574
1738
|
});
|
|
1575
1739
|
}
|
|
1576
1740
|
}
|
|
1577
|
-
return this.
|
|
1741
|
+
return this.apiRequest.makeRequest(request);
|
|
1578
1742
|
}
|
|
1579
1743
|
async postStatus() {
|
|
1580
|
-
return this.
|
|
1744
|
+
return this.apiRequest.makeRequest({
|
|
1581
1745
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}/${CALL_STATUS_RESOURCE}`,
|
|
1582
1746
|
method: HTTP_METHODS.POST,
|
|
1583
1747
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1688,7 +1852,7 @@ export class Call extends Eventing {
|
|
|
1688
1852
|
file: CALL_FILE,
|
|
1689
1853
|
method: METHODS.POST_MEDIA,
|
|
1690
1854
|
});
|
|
1691
|
-
return this.
|
|
1855
|
+
return this.apiRequest.makeRequest({
|
|
1692
1856
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}/${MEDIA_ENDPOINT_RESOURCE}`,
|
|
1693
1857
|
method: HTTP_METHODS.POST,
|
|
1694
1858
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1710,61 +1874,29 @@ export class Call extends Eventing {
|
|
|
1710
1874
|
});
|
|
1711
1875
|
}
|
|
1712
1876
|
mediaRoapEventsListener() {
|
|
1713
|
-
this.mediaConnection.on(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND,
|
|
1714
|
-
|
|
1715
|
-
\n type: ${event.roapMessage?.messageType}, seq: ${event.roapMessage.seq} , version: ${event.roapMessage.version}`, { file: CALL_FILE, method: METHODS.MEDIA_ROAP_EVENTS_LISTENER });
|
|
1716
|
-
log.info(`SDP message to send : \n ${event.roapMessage?.sdp}`, {
|
|
1717
|
-
file: CALL_FILE,
|
|
1718
|
-
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
1719
|
-
});
|
|
1720
|
-
switch (event.roapMessage.messageType) {
|
|
1721
|
-
case RoapScenario.OK: {
|
|
1722
|
-
const mediaOk = {
|
|
1723
|
-
received: false,
|
|
1724
|
-
message: event.roapMessage,
|
|
1725
|
-
};
|
|
1726
|
-
this.sendMediaStateMachineEvt({ type: 'E_ROAP_OK', data: mediaOk });
|
|
1727
|
-
break;
|
|
1728
|
-
}
|
|
1729
|
-
case RoapScenario.OFFER: {
|
|
1730
|
-
log.info(`before modifying sdp: ${event.roapMessage.sdp}`, {
|
|
1731
|
-
file: CALL_FILE,
|
|
1732
|
-
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
1733
|
-
});
|
|
1734
|
-
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
1735
|
-
const sdpVideoPortZero = event.roapMessage.sdp.replace(/^m=(video) (?:\d+) /gim, 'm=$1 0 ');
|
|
1736
|
-
log.info(`after modification sdp: ${sdpVideoPortZero}`, {
|
|
1737
|
-
file: CALL_FILE,
|
|
1738
|
-
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
1739
|
-
});
|
|
1740
|
-
event.roapMessage.sdp = sdpVideoPortZero;
|
|
1741
|
-
this.localRoapMessage = event.roapMessage;
|
|
1742
|
-
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_SETUP', data: event.roapMessage });
|
|
1743
|
-
break;
|
|
1744
|
-
}
|
|
1745
|
-
case RoapScenario.ANSWER:
|
|
1746
|
-
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
1747
|
-
this.localRoapMessage = event.roapMessage;
|
|
1748
|
-
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_ANSWER', data: event.roapMessage });
|
|
1749
|
-
break;
|
|
1750
|
-
case RoapScenario.ERROR:
|
|
1751
|
-
this.sendMediaStateMachineEvt({ type: 'E_ROAP_ERROR', data: event.roapMessage });
|
|
1752
|
-
break;
|
|
1753
|
-
case RoapScenario.OFFER_RESPONSE:
|
|
1754
|
-
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
1755
|
-
this.localRoapMessage = event.roapMessage;
|
|
1756
|
-
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_OFFER', data: event.roapMessage });
|
|
1757
|
-
break;
|
|
1758
|
-
default:
|
|
1759
|
-
}
|
|
1760
|
-
});
|
|
1877
|
+
this.mediaConnection.on(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, this.handleMediaRoapEvent);
|
|
1878
|
+
this.mediaConnection.on(MediaConnectionEventNames.ROAP_FAILURE, this.handleRoapFailure);
|
|
1761
1879
|
}
|
|
1762
1880
|
mediaTrackListener() {
|
|
1763
|
-
this.mediaConnection.on(MediaConnectionEventNames.REMOTE_TRACK_ADDED,
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1881
|
+
this.mediaConnection.on(MediaConnectionEventNames.REMOTE_TRACK_ADDED, this.handleRemoteTrackAdded);
|
|
1882
|
+
}
|
|
1883
|
+
mediaIceEventsListener() {
|
|
1884
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, this.handleIceGatheringStateChanged);
|
|
1885
|
+
this.mediaConnection.on(MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, this.handlePeerConnectionStateChanged);
|
|
1886
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, this.handleIceConnectionStateChanged);
|
|
1887
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_CANDIDATE_ERROR, this.handleIceCandidateError);
|
|
1888
|
+
}
|
|
1889
|
+
unregisterMediaConnectionListeners() {
|
|
1890
|
+
if (!this.mediaConnection || typeof this.mediaConnection.off !== 'function') {
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1893
|
+
this.mediaConnection.off(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, this.handleMediaRoapEvent);
|
|
1894
|
+
this.mediaConnection.off(MediaConnectionEventNames.ROAP_FAILURE, this.handleRoapFailure);
|
|
1895
|
+
this.mediaConnection.off(MediaConnectionEventNames.REMOTE_TRACK_ADDED, this.handleRemoteTrackAdded);
|
|
1896
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, this.handleIceGatheringStateChanged);
|
|
1897
|
+
this.mediaConnection.off(MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, this.handlePeerConnectionStateChanged);
|
|
1898
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, this.handleIceConnectionStateChanged);
|
|
1899
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_CANDIDATE_ERROR, this.handleIceCandidateError);
|
|
1768
1900
|
}
|
|
1769
1901
|
onEffectEnabled = () => {
|
|
1770
1902
|
this.metricManager.submitBNRMetric(METRIC_EVENT.BNR_ENABLED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId);
|
|
@@ -1778,7 +1910,7 @@ export class Call extends Eventing {
|
|
|
1778
1910
|
registerEffectListener = (addedEffect) => {
|
|
1779
1911
|
if (this.localAudioStream) {
|
|
1780
1912
|
const effect = this.localAudioStream.getEffectByKind(NOISE_REDUCTION_EFFECT);
|
|
1781
|
-
if (effect === addedEffect) {
|
|
1913
|
+
if (effect && effect === addedEffect) {
|
|
1782
1914
|
effect.on(EffectEvent.Enabled, this.onEffectEnabled);
|
|
1783
1915
|
effect.on(EffectEvent.Disabled, this.onEffectDisabled);
|
|
1784
1916
|
}
|
|
@@ -1809,7 +1941,7 @@ export class Call extends Eventing {
|
|
|
1809
1941
|
}
|
|
1810
1942
|
async delete() {
|
|
1811
1943
|
const disconnectMetrics = await this.getCallStats();
|
|
1812
|
-
return this.
|
|
1944
|
+
return this.apiRequest.makeRequest({
|
|
1813
1945
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}`,
|
|
1814
1946
|
method: HTTP_METHODS.DELETE,
|
|
1815
1947
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1834,7 +1966,7 @@ export class Call extends Eventing {
|
|
|
1834
1966
|
this.metricManager.submitCallMetric(METRIC_EVENT.CALL_ERROR, transferMetricAction || this.callStateMachine.state.value.toString(), METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, error);
|
|
1835
1967
|
}
|
|
1836
1968
|
else {
|
|
1837
|
-
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);
|
|
1969
|
+
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);
|
|
1838
1970
|
}
|
|
1839
1971
|
}
|
|
1840
1972
|
handleMidCallEvent(event) {
|
|
@@ -2014,4 +2146,4 @@ export class Call extends Eventing {
|
|
|
2014
2146
|
});
|
|
2015
2147
|
}
|
|
2016
2148
|
}
|
|
2017
|
-
export const createCall = (activeUrl, webex, dir, deviceId, lineId, deleteCb, indicator, dest) => new Call(activeUrl, webex, dir, deviceId, lineId, deleteCb, indicator, dest);
|
|
2149
|
+
export const createCall = (activeUrl, webex, dir, deviceId, lineId, deleteCb, indicator, dest, iceGatheringConfig) => new Call(activeUrl, webex, dir, deviceId, lineId, deleteCb, indicator, dest, iceGatheringConfig);
|
|
@@ -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,15 +16,20 @@ export class CallManager extends Eventing {
|
|
|
15
16
|
activeMobiusUrl;
|
|
16
17
|
serviceIndicator;
|
|
17
18
|
lineDict;
|
|
18
|
-
|
|
19
|
+
apiRequest;
|
|
20
|
+
isMobiusSocketListenerRegistered = false;
|
|
21
|
+
iceGatheringConfig;
|
|
22
|
+
constructor(webex, indicator, iceGatheringConfig) {
|
|
19
23
|
super();
|
|
20
24
|
this.sdkConnector = SDKConnector;
|
|
21
25
|
this.serviceIndicator = indicator;
|
|
26
|
+
this.iceGatheringConfig = iceGatheringConfig;
|
|
22
27
|
if (!this.sdkConnector.getWebex()) {
|
|
23
28
|
SDKConnector.setWebex(webex);
|
|
24
29
|
}
|
|
25
30
|
this.lineDict = {};
|
|
26
31
|
this.webex = this.sdkConnector.getWebex();
|
|
32
|
+
this.apiRequest = APIRequest.getInstance({ webex: this.webex });
|
|
27
33
|
this.callCollection = {};
|
|
28
34
|
this.activeMobiusUrl = '';
|
|
29
35
|
this.listenForWsEvents();
|
|
@@ -45,7 +51,7 @@ export class CallManager extends Eventing {
|
|
|
45
51
|
method: METHODS.CREATE_CALL,
|
|
46
52
|
});
|
|
47
53
|
}
|
|
48
|
-
}, this.serviceIndicator, destination);
|
|
54
|
+
}, this.serviceIndicator, destination, this.iceGatheringConfig);
|
|
49
55
|
this.callCollection[newCall.getCorrelationId()] = newCall;
|
|
50
56
|
log.log(`New call created with correlationId: ${newCall.getCorrelationId()}`, {});
|
|
51
57
|
log.info(`ADD:: Added corelationId: ${newCall.getCorrelationId()} to CallManager , Number of call records now:- ${Object.keys(this.getActiveCalls()).length}`, {});
|
|
@@ -57,15 +63,28 @@ export class CallManager extends Eventing {
|
|
|
57
63
|
file: CALL_MANAGER_FILE,
|
|
58
64
|
method: METHODS.UPDATE_ACTIVE_MOBIUS,
|
|
59
65
|
});
|
|
66
|
+
this.listenForWsEvents();
|
|
60
67
|
}
|
|
61
68
|
listenForWsEvents() {
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
const socketEnabled = this.apiRequest.isSocketEnabled();
|
|
70
|
+
if (!socketEnabled && !this.isMobiusSocketListenerRegistered) {
|
|
71
|
+
this.sdkConnector.registerListener('event:mobius', async (event) => {
|
|
72
|
+
this.dequeueWsEvents(event);
|
|
73
|
+
});
|
|
74
|
+
this.isMobiusSocketListenerRegistered = true;
|
|
75
|
+
log.info('Successfully registered listener for Mobius events', {
|
|
76
|
+
file: CALL_MANAGER_FILE,
|
|
77
|
+
method: METHODS.REGISTER_SESSIONS_LISTENER,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else if (socketEnabled && this.isMobiusSocketListenerRegistered) {
|
|
81
|
+
this.sdkConnector.unregisterListener('event:mobius');
|
|
82
|
+
this.isMobiusSocketListenerRegistered = false;
|
|
83
|
+
log.info('Unregistered Mercury listener for Mobius events; using WebSocket transport', {
|
|
84
|
+
file: CALL_MANAGER_FILE,
|
|
85
|
+
method: METHODS.REGISTER_SESSIONS_LISTENER,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
69
88
|
}
|
|
70
89
|
dequeueWsEvents(event) {
|
|
71
90
|
log.info(`${METHOD_START_MESSAGE} with event ${event}`, {
|
|
@@ -147,6 +166,21 @@ export class CallManager extends Eventing {
|
|
|
147
166
|
call.sendCallStateMachineEvt({ type: 'E_RECV_CALL_PROGRESS', data: mobiusEvent.data });
|
|
148
167
|
break;
|
|
149
168
|
}
|
|
169
|
+
case MobiusEventType.CALL_INFO: {
|
|
170
|
+
log.log(`Received call info mobiusEvent for call: ${correlationId}`, {
|
|
171
|
+
file: CALL_MANAGER_FILE,
|
|
172
|
+
method: METHODS.DEQUEUE_WS_EVENTS,
|
|
173
|
+
});
|
|
174
|
+
const call = this.getCall(correlationId);
|
|
175
|
+
if (call && mobiusEvent.data.callerId) {
|
|
176
|
+
log.info('Processing Caller-Id data', {
|
|
177
|
+
file: CALL_MANAGER_FILE,
|
|
178
|
+
method: METHODS.DEQUEUE_WS_EVENTS,
|
|
179
|
+
});
|
|
180
|
+
call.startCallerIdResolution(mobiusEvent.data.callerId);
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
150
184
|
case MobiusEventType.CALL_MEDIA: {
|
|
151
185
|
log.log(`Received call media mobiusEvent for call: ${correlationId}`, {
|
|
152
186
|
file: CALL_MANAGER_FILE,
|
|
@@ -301,10 +335,16 @@ export class CallManager extends Eventing {
|
|
|
301
335
|
getLineId(deviceId) {
|
|
302
336
|
return this.lineDict[deviceId].lineId;
|
|
303
337
|
}
|
|
338
|
+
setIceGatheringConfig(iceGatheringConfig) {
|
|
339
|
+
this.iceGatheringConfig = iceGatheringConfig;
|
|
340
|
+
}
|
|
304
341
|
}
|
|
305
|
-
export const getCallManager = (webex, indicator) => {
|
|
342
|
+
export const getCallManager = (webex, indicator, iceGatheringConfig) => {
|
|
306
343
|
if (!callManager) {
|
|
307
|
-
callManager = new CallManager(webex, indicator);
|
|
344
|
+
callManager = new CallManager(webex, indicator, iceGatheringConfig);
|
|
345
|
+
}
|
|
346
|
+
else if (iceGatheringConfig) {
|
|
347
|
+
callManager.setIceGatheringConfig(iceGatheringConfig);
|
|
308
348
|
}
|
|
309
349
|
return callManager;
|
|
310
350
|
};
|
|
@@ -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_';
|
|
@@ -127,6 +130,9 @@ export const MOBIUS_EU_INT = 'mobius-eu-central-1.int.infra.webex.com';
|
|
|
127
130
|
export const FAILOVER_CACHE_PREFIX = 'wxc-failover-state';
|
|
128
131
|
export const ACTIVE_MOBIUS_STORAGE_KEY = 'wxc-active-mobius';
|
|
129
132
|
export const ICE_CANDIDATES_TIMEOUT = 3000;
|
|
133
|
+
export const ICE_LITE_CANDIDATES_TIMEOUT = 500;
|
|
134
|
+
export const WCC_CALLING_RTMS_DOMAIN = 'wcc-calling-rtms-domain';
|
|
135
|
+
export const SESSION_SUPERSEDED_MESSAGE = 'This calling session has been superseded by another registration for the same user, for example calling opened in another browser tab or device. Calling is no longer available on this session.';
|
|
130
136
|
export const METHODS = {
|
|
131
137
|
CONSTRUCTOR: 'constructor',
|
|
132
138
|
CREATE_CALL: 'createCall',
|
|
@@ -179,6 +185,7 @@ export const METHODS = {
|
|
|
179
185
|
POST_MEDIA: 'postMedia',
|
|
180
186
|
MEDIA_ROAP_EVENTS_LISTENER: 'mediaRoapEventsListener',
|
|
181
187
|
MEDIA_TRACK_LISTENER: 'mediaTrackListener',
|
|
188
|
+
MEDIA_ICE_EVENTS_LISTENER: 'mediaIceEventsListener',
|
|
182
189
|
ON_EFFECT_ENABLED: 'onEffectEnabled',
|
|
183
190
|
ON_EFFECT_DISABLED: 'onEffectDisabled',
|
|
184
191
|
UPDATE_TRACK: 'updateTrack',
|
|
@@ -230,4 +237,24 @@ export const METHODS = {
|
|
|
230
237
|
UPLOAD_LOGS: 'uploadLogs',
|
|
231
238
|
GET_SDK_CONNECTOR: 'getSDKConnector',
|
|
232
239
|
GET_CONNECTED_CALL: 'getConnectedCall',
|
|
240
|
+
CONNECT_TO_MOBIUS_SOCKET: 'connectToMobiusSocket',
|
|
241
|
+
SET_SOCKET_ENABLED: 'setSocketEnabled',
|
|
242
|
+
REGISTER_MOBIUS_SOCKET_LISTENER: 'registerMobiusSocketListener',
|
|
243
|
+
UNREGISTER_MOBIUS_SOCKET_LISTENER: 'unregisterMobiusSocketListener',
|
|
244
|
+
REGISTER_MOBIUS_SOCKET_CONNECTION_LISTENER: 'registerMobiusSocketConnectionListener',
|
|
245
|
+
UNREGISTER_MOBIUS_SOCKET_CONNECTION_LISTENER: 'unregisterMobiusSocketConnectionListener',
|
|
246
|
+
HANDLE_MOBIUS_ASYNC_EVENT: 'handleMobiusAsyncEvent',
|
|
247
|
+
HANDLE_REGISTRATION_DOWN_EVENT: 'handleRegistrationDownEvent',
|
|
248
|
+
DISCONNECT_FROM_MOBIUS_SOCKET: 'disconnectFromMobiusSocket',
|
|
249
|
+
MAKE_REQUEST: 'makeRequest',
|
|
250
|
+
DERIVE_MOBIUS_SOCKET_MESSAGE_TYPE: 'deriveMobiusSocketMessageType',
|
|
251
|
+
IS_MOBIUS_WSS_ENABLED: 'isMobiusWssEnabled',
|
|
252
|
+
RESTORE_PREVIOUS_REGISTRATION: 'restorePreviousRegistration',
|
|
253
|
+
RESTART_REGISTRATION: 'restartRegistration',
|
|
254
|
+
TRIGGER_REGISTRATION: 'triggerRegistration',
|
|
255
|
+
HANDLE_404_KEEPALIVE_FAILURE: 'handle404KeepaliveFailure',
|
|
256
|
+
HANDLE_409_KEEPALIVE_FAILURE: 'handle409KeepaliveFailure',
|
|
257
|
+
INITIATE_FAILBACK: 'initiateFailback',
|
|
258
|
+
EXECUTE_FAILBACK: 'executeFailback',
|
|
259
|
+
GET_RTMS_DOMAIN: 'getRTMSDomain',
|
|
233
260
|
};
|
|
@@ -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) {
|
|
@@ -107,6 +107,8 @@ export default class Line extends Eventing {
|
|
|
107
107
|
}
|
|
108
108
|
break;
|
|
109
109
|
case LINE_EVENTS.UNREGISTERED:
|
|
110
|
+
this.emit(event, lineError);
|
|
111
|
+
break;
|
|
110
112
|
case LINE_EVENTS.RECONNECTED:
|
|
111
113
|
case LINE_EVENTS.RECONNECTING:
|
|
112
114
|
this.emit(event);
|