@webex/calling 3.12.0-next.11 → 3.12.0-next.111
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 +469 -233
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +736 -179
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +645 -458
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +928 -498
- 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 +33 -3
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +27 -3
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +102 -17
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +971 -506
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +946 -61
- 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 +198 -124
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +414 -229
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/callUtils.js +187 -0
- package/dist/common/callUtils.js.map +1 -0
- package/dist/common/callUtils.test.js +313 -0
- package/dist/common/callUtils.test.js.map +1 -0
- package/dist/common/constants.js +18 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/index.js +11 -0
- package/dist/common/index.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 +137 -20
- package/dist/module/CallingClient/calling/call.js +207 -68
- package/dist/module/CallingClient/calling/callManager.js +51 -11
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +28 -0
- package/dist/module/CallingClient/line/index.js +11 -3
- package/dist/module/CallingClient/registration/register.js +297 -68
- 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 +77 -56
- package/dist/module/common/callUtils.js +90 -0
- package/dist/module/common/constants.js +5 -0
- package/dist/module/common/index.js +1 -0
- 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 +28 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +3 -2
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +9 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +26 -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 +6 -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 -5
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/callUtils.d.ts +6 -0
- package/dist/types/common/callUtils.d.ts.map +1 -0
- package/dist/types/common/constants.d.ts +5 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/index.d.ts +1 -0
- package/dist/types/common/index.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 +20 -7
- package/src/mobius-socket/socket/socket.shim.ts +22 -0
- package/src/mobius-socket/socket/socket.ts +14 -0
|
@@ -4,19 +4,21 @@ import { v4 as uuid } from 'uuid';
|
|
|
4
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
|
-
import { handleCallErrors,
|
|
7
|
+
import { handleCallErrors, parseMediaQualityStatistics, serviceErrorCodeHandler, uploadLogs, } from '../../common/Utils';
|
|
8
|
+
import { getHostIpsFromSdp, modifySdpForIPv4 } from '../../common/callUtils';
|
|
8
9
|
import { ALLOWED_SERVICES, CallDirection, HTTP_METHODS, } from '../../common/types';
|
|
9
10
|
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';
|
|
11
|
+
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
12
|
import SDKConnector from '../../SDKConnector';
|
|
12
13
|
import { Eventing } from '../../Events/impl';
|
|
13
14
|
import { CALL_EVENT_KEYS, MEDIA_CONNECTION_EVENT_KEYS, MOBIUS_MIDCALL_STATE, SUPPLEMENTARY_SERVICES, } from '../../Events/types';
|
|
14
15
|
import { DisconnectCause, DisconnectCode, MidCallEventType, MobiusCallState, MUTE_TYPE, RoapScenario, TransferType, } from './types';
|
|
15
16
|
import log from '../../Logger';
|
|
16
17
|
import { createCallerId } from './CallerId';
|
|
17
|
-
import { METRIC_TYPE, METRIC_EVENT, TRANSFER_ACTION } from '../../Metrics/types';
|
|
18
|
+
import { METRIC_TYPE, METRIC_EVENT, TRANSFER_ACTION, MEDIA_CONNECTION_ACTION, } from '../../Metrics/types';
|
|
18
19
|
import { getMetricManager } from '../../Metrics';
|
|
19
20
|
import { METHOD_START_MESSAGE, SERVICES_ENDPOINT } from '../../common/constants';
|
|
21
|
+
import { APIRequest } from '../utils/request';
|
|
20
22
|
export class Call extends Eventing {
|
|
21
23
|
sdkConnector;
|
|
22
24
|
webex;
|
|
@@ -48,10 +50,144 @@ export class Call extends Eventing {
|
|
|
48
50
|
broadworksCorrelationInfo;
|
|
49
51
|
serviceIndicator;
|
|
50
52
|
mediaNegotiationCompleted;
|
|
53
|
+
connectPending;
|
|
51
54
|
receivedRoapOKSeq;
|
|
52
55
|
localAudioStream;
|
|
53
56
|
rtcMetrics;
|
|
54
57
|
callKeepaliveRetryCount = 0;
|
|
58
|
+
apiRequest;
|
|
59
|
+
iceGatheringConfig;
|
|
60
|
+
handleMediaRoapEvent = async (event) => {
|
|
61
|
+
log.info(`ROAP message to send (rcv from MEDIA-SDK) :
|
|
62
|
+
\n type: ${event.roapMessage?.messageType}, seq: ${event.roapMessage.seq} , version: ${event.roapMessage.version}`, { file: CALL_FILE, method: METHODS.MEDIA_ROAP_EVENTS_LISTENER });
|
|
63
|
+
log.info(`SDP message to send : \n ${event.roapMessage?.sdp}`, {
|
|
64
|
+
file: CALL_FILE,
|
|
65
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
66
|
+
});
|
|
67
|
+
switch (event.roapMessage.messageType) {
|
|
68
|
+
case RoapScenario.OK: {
|
|
69
|
+
const mediaOk = {
|
|
70
|
+
received: false,
|
|
71
|
+
message: event.roapMessage,
|
|
72
|
+
};
|
|
73
|
+
this.sendMediaStateMachineEvt({ type: 'E_ROAP_OK', data: mediaOk });
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case RoapScenario.OFFER: {
|
|
77
|
+
if (!event.roapMessage.sdp) {
|
|
78
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
79
|
+
file: CALL_FILE,
|
|
80
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
81
|
+
});
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
log.info(`before modifying sdp: ${event.roapMessage.sdp}`, {
|
|
85
|
+
file: CALL_FILE,
|
|
86
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
87
|
+
});
|
|
88
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
89
|
+
const sdpVideoPortZero = event.roapMessage.sdp.replace(/^m=(video) (?:\d+) /gim, 'm=$1 0 ');
|
|
90
|
+
log.info(`after modification sdp: ${sdpVideoPortZero}`, {
|
|
91
|
+
file: CALL_FILE,
|
|
92
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
93
|
+
});
|
|
94
|
+
event.roapMessage.sdp = sdpVideoPortZero;
|
|
95
|
+
this.localRoapMessage = event.roapMessage;
|
|
96
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_SETUP', data: event.roapMessage });
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case RoapScenario.ANSWER:
|
|
100
|
+
if (!event.roapMessage.sdp) {
|
|
101
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
102
|
+
file: CALL_FILE,
|
|
103
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
108
|
+
this.localRoapMessage = event.roapMessage;
|
|
109
|
+
if (this.connectPending) {
|
|
110
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_CONNECT' });
|
|
111
|
+
}
|
|
112
|
+
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_ANSWER', data: event.roapMessage });
|
|
113
|
+
break;
|
|
114
|
+
case RoapScenario.ERROR:
|
|
115
|
+
this.sendMediaStateMachineEvt({ type: 'E_ROAP_ERROR', data: event.roapMessage });
|
|
116
|
+
break;
|
|
117
|
+
case RoapScenario.OFFER_RESPONSE:
|
|
118
|
+
if (!event.roapMessage.sdp) {
|
|
119
|
+
log.warn('Received OFFER without SDP from media SDK', {
|
|
120
|
+
file: CALL_FILE,
|
|
121
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
122
|
+
});
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
event.roapMessage.sdp = modifySdpForIPv4(event.roapMessage.sdp);
|
|
126
|
+
this.localRoapMessage = event.roapMessage;
|
|
127
|
+
if (this.connectPending) {
|
|
128
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_CONNECT' });
|
|
129
|
+
}
|
|
130
|
+
this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_OFFER', data: event.roapMessage });
|
|
131
|
+
break;
|
|
132
|
+
default:
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
handleRemoteTrackAdded = (event) => {
|
|
136
|
+
if (event.type === MEDIA_CONNECTION_EVENT_KEYS.MEDIA_TYPE_AUDIO) {
|
|
137
|
+
this.emit(CALL_EVENT_KEYS.REMOTE_MEDIA, event.track);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
static getPeerConnectionStateFromEvent(event, preferredKey) {
|
|
141
|
+
return event[preferredKey] || event.state || 'unknown';
|
|
142
|
+
}
|
|
143
|
+
handleIceGatheringStateChanged = (event) => {
|
|
144
|
+
const iceGatheringState = Call.getPeerConnectionStateFromEvent(event, 'iceGatheringState');
|
|
145
|
+
log.info(`ICE gathering state changed to: ${iceGatheringState}`, {
|
|
146
|
+
file: CALL_FILE,
|
|
147
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
148
|
+
});
|
|
149
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.ICE_GATHERING_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, iceGatheringState);
|
|
150
|
+
};
|
|
151
|
+
handlePeerConnectionStateChanged = (event) => {
|
|
152
|
+
const connectionState = Call.getPeerConnectionStateFromEvent(event, 'connectionState');
|
|
153
|
+
log.info(`Peer connection state changed to: ${connectionState}`, {
|
|
154
|
+
file: CALL_FILE,
|
|
155
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
156
|
+
});
|
|
157
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.PEER_CONNECTION_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, connectionState);
|
|
158
|
+
};
|
|
159
|
+
handleIceConnectionStateChanged = (event) => {
|
|
160
|
+
const iceConnectionState = Call.getPeerConnectionStateFromEvent(event, 'iceConnectionState');
|
|
161
|
+
log.info(`ICE connection state changed to: ${iceConnectionState}`, {
|
|
162
|
+
file: CALL_FILE,
|
|
163
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
164
|
+
});
|
|
165
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, MEDIA_CONNECTION_ACTION.ICE_CONNECTION_STATE_CHANGED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, iceConnectionState);
|
|
166
|
+
};
|
|
167
|
+
handleIceCandidateError = (event) => {
|
|
168
|
+
const iceErrorPayload = {
|
|
169
|
+
address: event.address ?? null,
|
|
170
|
+
errorCode: event.errorCode,
|
|
171
|
+
errorText: event.errorText,
|
|
172
|
+
port: event.port ?? null,
|
|
173
|
+
url: event.url,
|
|
174
|
+
};
|
|
175
|
+
log.warn(`ICE candidate error occurred: ${JSON.stringify(iceErrorPayload)}`, {
|
|
176
|
+
file: CALL_FILE,
|
|
177
|
+
method: METHODS.MEDIA_ICE_EVENTS_LISTENER,
|
|
178
|
+
});
|
|
179
|
+
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);
|
|
180
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA_ERROR, MEDIA_CONNECTION_ACTION.ICE_CANDIDATE_ERROR, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, undefined, callError);
|
|
181
|
+
};
|
|
182
|
+
handleRoapFailure = (error) => {
|
|
183
|
+
const failureMessage = error.message || 'Unknown ROAP failure received from media SDK';
|
|
184
|
+
log.warn(`ROAP failure occurred: ${failureMessage}`, {
|
|
185
|
+
file: CALL_FILE,
|
|
186
|
+
method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
|
|
187
|
+
});
|
|
188
|
+
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);
|
|
189
|
+
this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA_ERROR, MEDIA_CONNECTION_ACTION.ROAP_FAILURE, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined, undefined, undefined, callError);
|
|
190
|
+
};
|
|
55
191
|
isMuted() {
|
|
56
192
|
return this.muted;
|
|
57
193
|
}
|
|
@@ -61,7 +197,7 @@ export class Call extends Eventing {
|
|
|
61
197
|
isHeld() {
|
|
62
198
|
return this.held;
|
|
63
199
|
}
|
|
64
|
-
constructor(activeUrl, webex, direction, deviceId, lineId, deleteCb, indicator, destination) {
|
|
200
|
+
constructor(activeUrl, webex, direction, deviceId, lineId, deleteCb, indicator, destination, iceGatheringConfig) {
|
|
65
201
|
super();
|
|
66
202
|
this.destination = destination;
|
|
67
203
|
this.direction = direction;
|
|
@@ -69,6 +205,7 @@ export class Call extends Eventing {
|
|
|
69
205
|
this.deviceId = deviceId;
|
|
70
206
|
this.serviceIndicator = indicator;
|
|
71
207
|
this.lineId = lineId;
|
|
208
|
+
this.iceGatheringConfig = iceGatheringConfig;
|
|
72
209
|
if (!this.sdkConnector.getWebex()) {
|
|
73
210
|
SDKConnector.setWebex(webex);
|
|
74
211
|
}
|
|
@@ -86,6 +223,7 @@ export class Call extends Eventing {
|
|
|
86
223
|
this.mobiusUrl = activeUrl;
|
|
87
224
|
this.receivedRoapOKSeq = 0;
|
|
88
225
|
this.mediaNegotiationCompleted = false;
|
|
226
|
+
this.connectPending = false;
|
|
89
227
|
log.info(`Webex Calling Url:- ${this.mobiusUrl}`, {
|
|
90
228
|
file: CALL_FILE,
|
|
91
229
|
method: METHODS.CONSTRUCTOR,
|
|
@@ -102,6 +240,7 @@ export class Call extends Eventing {
|
|
|
102
240
|
this.remoteRoapMessage = null;
|
|
103
241
|
this.disconnectReason = { code: DisconnectCode.NORMAL, cause: DisconnectCause.NORMAL };
|
|
104
242
|
this.rtcMetrics = new RtcMetrics(this.webex, { callId: this.callId }, this.correlationId);
|
|
243
|
+
this.apiRequest = APIRequest.getInstance({ webex: this.webex });
|
|
105
244
|
const callMachine = createMachine({
|
|
106
245
|
schema: {
|
|
107
246
|
context: {},
|
|
@@ -281,6 +420,11 @@ export class Call extends Eventing {
|
|
|
281
420
|
},
|
|
282
421
|
},
|
|
283
422
|
on: {
|
|
423
|
+
E_SEND_CALL_CONNECT: {
|
|
424
|
+
cond: () => this.connectPending,
|
|
425
|
+
target: 'S_SEND_CALL_CONNECT',
|
|
426
|
+
actions: ['outgoingCallConnect'],
|
|
427
|
+
},
|
|
284
428
|
E_CALL_ESTABLISHED: {
|
|
285
429
|
target: 'S_CALL_ESTABLISHED',
|
|
286
430
|
actions: ['callEstablished'],
|
|
@@ -842,6 +986,7 @@ export class Call extends Eventing {
|
|
|
842
986
|
}
|
|
843
987
|
}
|
|
844
988
|
async handleOutgoingCallConnect(event) {
|
|
989
|
+
this.connectPending = false;
|
|
845
990
|
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
|
|
846
991
|
file: CALL_FILE,
|
|
847
992
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
@@ -851,6 +996,7 @@ export class Call extends Eventing {
|
|
|
851
996
|
file: CALL_FILE,
|
|
852
997
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
853
998
|
});
|
|
999
|
+
this.connectPending = true;
|
|
854
1000
|
return;
|
|
855
1001
|
}
|
|
856
1002
|
try {
|
|
@@ -910,6 +1056,7 @@ export class Call extends Eventing {
|
|
|
910
1056
|
clearInterval(this.sessionTimer);
|
|
911
1057
|
}
|
|
912
1058
|
if (this.mediaConnection) {
|
|
1059
|
+
this.unregisterMediaConnectionListeners();
|
|
913
1060
|
this.mediaConnection.close();
|
|
914
1061
|
log.info('Closing media channel', {
|
|
915
1062
|
file: CALL_FILE,
|
|
@@ -953,6 +1100,7 @@ export class Call extends Eventing {
|
|
|
953
1100
|
clearInterval(this.sessionTimer);
|
|
954
1101
|
}
|
|
955
1102
|
if (this.mediaConnection) {
|
|
1103
|
+
this.unregisterMediaConnectionListeners();
|
|
956
1104
|
this.mediaConnection.close();
|
|
957
1105
|
log.info('Closing media channel', {
|
|
958
1106
|
file: CALL_FILE,
|
|
@@ -1064,6 +1212,7 @@ export class Call extends Eventing {
|
|
|
1064
1212
|
clearInterval(this.sessionTimer);
|
|
1065
1213
|
}
|
|
1066
1214
|
if (this.mediaConnection) {
|
|
1215
|
+
this.unregisterMediaConnectionListeners();
|
|
1067
1216
|
this.mediaConnection.close();
|
|
1068
1217
|
log.info('Closing media channel', {
|
|
1069
1218
|
file: CALL_FILE,
|
|
@@ -1358,11 +1507,25 @@ export class Call extends Eventing {
|
|
|
1358
1507
|
});
|
|
1359
1508
|
}
|
|
1360
1509
|
};
|
|
1510
|
+
getIceCandidatesTimeout() {
|
|
1511
|
+
if (!this.iceGatheringConfig?.reduceTimeoutForIceLite) {
|
|
1512
|
+
return ICE_CANDIDATES_TIMEOUT;
|
|
1513
|
+
}
|
|
1514
|
+
const remoteSdp = this.remoteRoapMessage?.sdp;
|
|
1515
|
+
if (remoteSdp && /^a=ice-lite[\r\n]*$/im.test(remoteSdp)) {
|
|
1516
|
+
log.info('Remote offer advertises ice-lite, using reduced ICE candidates timeout', {
|
|
1517
|
+
file: CALL_FILE,
|
|
1518
|
+
method: METHODS.INIT_MEDIA_CONNECTION,
|
|
1519
|
+
});
|
|
1520
|
+
return this.iceGatheringConfig.iceLiteTimeout ?? ICE_LITE_CANDIDATES_TIMEOUT;
|
|
1521
|
+
}
|
|
1522
|
+
return ICE_CANDIDATES_TIMEOUT;
|
|
1523
|
+
}
|
|
1361
1524
|
initMediaConnection(localAudioTrack, debugId) {
|
|
1362
1525
|
const mediaConnection = new RoapMediaConnection({
|
|
1363
1526
|
skipInactiveTransceivers: true,
|
|
1364
1527
|
iceServers: [],
|
|
1365
|
-
iceCandidatesTimeout:
|
|
1528
|
+
iceCandidatesTimeout: this.getIceCandidatesTimeout(),
|
|
1366
1529
|
sdpMunging: {
|
|
1367
1530
|
convertPort9to0: true,
|
|
1368
1531
|
addContentSlides: false,
|
|
@@ -1435,6 +1598,7 @@ export class Call extends Eventing {
|
|
|
1435
1598
|
this.initMediaConnection(localAudioTrack);
|
|
1436
1599
|
this.mediaRoapEventsListener();
|
|
1437
1600
|
this.mediaTrackListener();
|
|
1601
|
+
this.mediaIceEventsListener();
|
|
1438
1602
|
this.registerListeners(localAudioStream);
|
|
1439
1603
|
}
|
|
1440
1604
|
if (this.callStateMachine.state.value === 'S_SEND_CALL_PROGRESS') {
|
|
@@ -1465,6 +1629,7 @@ export class Call extends Eventing {
|
|
|
1465
1629
|
this.initMediaConnection(localAudioTrack);
|
|
1466
1630
|
this.mediaRoapEventsListener();
|
|
1467
1631
|
this.mediaTrackListener();
|
|
1632
|
+
this.mediaIceEventsListener();
|
|
1468
1633
|
this.registerListeners(localAudioStream);
|
|
1469
1634
|
}
|
|
1470
1635
|
if (this.mediaStateMachine.state.value === 'S_ROAP_IDLE') {
|
|
@@ -1475,6 +1640,7 @@ export class Call extends Eventing {
|
|
|
1475
1640
|
}
|
|
1476
1641
|
}
|
|
1477
1642
|
post = async (roapMessage) => {
|
|
1643
|
+
const hostIps = getHostIpsFromSdp(roapMessage?.sdp);
|
|
1478
1644
|
const basePayload = {
|
|
1479
1645
|
device: {
|
|
1480
1646
|
deviceId: this.deviceId,
|
|
@@ -1484,8 +1650,9 @@ export class Call extends Eventing {
|
|
|
1484
1650
|
roap: roapMessage,
|
|
1485
1651
|
mediaId: uuid(),
|
|
1486
1652
|
},
|
|
1653
|
+
hostIps,
|
|
1487
1654
|
};
|
|
1488
|
-
return this.
|
|
1655
|
+
return this.apiRequest.makeRequest({
|
|
1489
1656
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALL_ENDPOINT_RESOURCE}`,
|
|
1490
1657
|
method: HTTP_METHODS.POST,
|
|
1491
1658
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1509,7 +1676,7 @@ export class Call extends Eventing {
|
|
|
1509
1676
|
file: CALL_FILE,
|
|
1510
1677
|
method: 'patch',
|
|
1511
1678
|
});
|
|
1512
|
-
return this.
|
|
1679
|
+
return this.apiRequest.makeRequest({
|
|
1513
1680
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}`,
|
|
1514
1681
|
method: HTTP_METHODS.PATCH,
|
|
1515
1682
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1574,10 +1741,10 @@ export class Call extends Eventing {
|
|
|
1574
1741
|
});
|
|
1575
1742
|
}
|
|
1576
1743
|
}
|
|
1577
|
-
return this.
|
|
1744
|
+
return this.apiRequest.makeRequest(request);
|
|
1578
1745
|
}
|
|
1579
1746
|
async postStatus() {
|
|
1580
|
-
return this.
|
|
1747
|
+
return this.apiRequest.makeRequest({
|
|
1581
1748
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}/${CALL_STATUS_RESOURCE}`,
|
|
1582
1749
|
method: HTTP_METHODS.POST,
|
|
1583
1750
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1688,7 +1855,8 @@ export class Call extends Eventing {
|
|
|
1688
1855
|
file: CALL_FILE,
|
|
1689
1856
|
method: METHODS.POST_MEDIA,
|
|
1690
1857
|
});
|
|
1691
|
-
|
|
1858
|
+
const hostIps = getHostIpsFromSdp(roapMessage?.sdp);
|
|
1859
|
+
return this.apiRequest.makeRequest({
|
|
1692
1860
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}/${MEDIA_ENDPOINT_RESOURCE}`,
|
|
1693
1861
|
method: HTTP_METHODS.POST,
|
|
1694
1862
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1706,65 +1874,34 @@ export class Call extends Eventing {
|
|
|
1706
1874
|
roap: roapMessage,
|
|
1707
1875
|
mediaId: uuid(),
|
|
1708
1876
|
},
|
|
1877
|
+
hostIps,
|
|
1709
1878
|
},
|
|
1710
1879
|
});
|
|
1711
1880
|
}
|
|
1712
1881
|
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
|
-
});
|
|
1882
|
+
this.mediaConnection.on(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, this.handleMediaRoapEvent);
|
|
1883
|
+
this.mediaConnection.on(MediaConnectionEventNames.ROAP_FAILURE, this.handleRoapFailure);
|
|
1761
1884
|
}
|
|
1762
1885
|
mediaTrackListener() {
|
|
1763
|
-
this.mediaConnection.on(MediaConnectionEventNames.REMOTE_TRACK_ADDED,
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1886
|
+
this.mediaConnection.on(MediaConnectionEventNames.REMOTE_TRACK_ADDED, this.handleRemoteTrackAdded);
|
|
1887
|
+
}
|
|
1888
|
+
mediaIceEventsListener() {
|
|
1889
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, this.handleIceGatheringStateChanged);
|
|
1890
|
+
this.mediaConnection.on(MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, this.handlePeerConnectionStateChanged);
|
|
1891
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, this.handleIceConnectionStateChanged);
|
|
1892
|
+
this.mediaConnection.on(MediaConnectionEventNames.ICE_CANDIDATE_ERROR, this.handleIceCandidateError);
|
|
1893
|
+
}
|
|
1894
|
+
unregisterMediaConnectionListeners() {
|
|
1895
|
+
if (!this.mediaConnection || typeof this.mediaConnection.off !== 'function') {
|
|
1896
|
+
return;
|
|
1897
|
+
}
|
|
1898
|
+
this.mediaConnection.off(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, this.handleMediaRoapEvent);
|
|
1899
|
+
this.mediaConnection.off(MediaConnectionEventNames.ROAP_FAILURE, this.handleRoapFailure);
|
|
1900
|
+
this.mediaConnection.off(MediaConnectionEventNames.REMOTE_TRACK_ADDED, this.handleRemoteTrackAdded);
|
|
1901
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_GATHERING_STATE_CHANGED, this.handleIceGatheringStateChanged);
|
|
1902
|
+
this.mediaConnection.off(MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED, this.handlePeerConnectionStateChanged);
|
|
1903
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_CONNECTION_STATE_CHANGED, this.handleIceConnectionStateChanged);
|
|
1904
|
+
this.mediaConnection.off(MediaConnectionEventNames.ICE_CANDIDATE_ERROR, this.handleIceCandidateError);
|
|
1768
1905
|
}
|
|
1769
1906
|
onEffectEnabled = () => {
|
|
1770
1907
|
this.metricManager.submitBNRMetric(METRIC_EVENT.BNR_ENABLED, METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId);
|
|
@@ -1778,7 +1915,7 @@ export class Call extends Eventing {
|
|
|
1778
1915
|
registerEffectListener = (addedEffect) => {
|
|
1779
1916
|
if (this.localAudioStream) {
|
|
1780
1917
|
const effect = this.localAudioStream.getEffectByKind(NOISE_REDUCTION_EFFECT);
|
|
1781
|
-
if (effect === addedEffect) {
|
|
1918
|
+
if (effect && effect === addedEffect) {
|
|
1782
1919
|
effect.on(EffectEvent.Enabled, this.onEffectEnabled);
|
|
1783
1920
|
effect.on(EffectEvent.Disabled, this.onEffectDisabled);
|
|
1784
1921
|
}
|
|
@@ -1809,7 +1946,7 @@ export class Call extends Eventing {
|
|
|
1809
1946
|
}
|
|
1810
1947
|
async delete() {
|
|
1811
1948
|
const disconnectMetrics = await this.getCallStats();
|
|
1812
|
-
return this.
|
|
1949
|
+
return this.apiRequest.makeRequest({
|
|
1813
1950
|
uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}`,
|
|
1814
1951
|
method: HTTP_METHODS.DELETE,
|
|
1815
1952
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
@@ -1822,7 +1959,9 @@ export class Call extends Eventing {
|
|
|
1822
1959
|
deviceId: this.deviceId,
|
|
1823
1960
|
correlationId: this.correlationId,
|
|
1824
1961
|
},
|
|
1825
|
-
callId: this.callId
|
|
1962
|
+
callId: this.callId.includes(DEFAULT_LOCAL_CALL_ID)
|
|
1963
|
+
? this.callId.replace(`${DEFAULT_LOCAL_CALL_ID}_`, '')
|
|
1964
|
+
: this.callId,
|
|
1826
1965
|
metrics: disconnectMetrics,
|
|
1827
1966
|
causecode: this.disconnectReason.code,
|
|
1828
1967
|
cause: this.disconnectReason.cause,
|
|
@@ -1834,7 +1973,7 @@ export class Call extends Eventing {
|
|
|
1834
1973
|
this.metricManager.submitCallMetric(METRIC_EVENT.CALL_ERROR, transferMetricAction || this.callStateMachine.state.value.toString(), METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, error);
|
|
1835
1974
|
}
|
|
1836
1975
|
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);
|
|
1976
|
+
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
1977
|
}
|
|
1839
1978
|
}
|
|
1840
1979
|
handleMidCallEvent(event) {
|
|
@@ -2014,4 +2153,4 @@ export class Call extends Eventing {
|
|
|
2014
2153
|
});
|
|
2015
2154
|
}
|
|
2016
2155
|
}
|
|
2017
|
-
export const createCall = (activeUrl, webex, dir, deviceId, lineId, deleteCb, indicator, dest) => new Call(activeUrl, webex, dir, deviceId, lineId, deleteCb, indicator, dest);
|
|
2156
|
+
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) {
|
|
@@ -63,12 +63,16 @@ export const WEBEX = 'webex';
|
|
|
63
63
|
export const WEBEX_WEB_CLIENT = 'webex-web-client';
|
|
64
64
|
export const CALLER_ID_FILE = 'CallerId';
|
|
65
65
|
export const UTILS_FILE = 'src/common/Utils.ts';
|
|
66
|
+
export const CALL_UTILS_FILE = 'src/common/callUtils.ts';
|
|
66
67
|
export const CALLING_CLIENT_FILE = 'CallingClient';
|
|
67
68
|
export const LINE_FILE = 'line';
|
|
68
69
|
export const CALL_FILE = 'call';
|
|
69
70
|
export const CALL_MANAGER_FILE = 'callManager';
|
|
70
71
|
export const METRIC_FILE = 'metric';
|
|
71
72
|
export const REGISTRATION_FILE = 'register';
|
|
73
|
+
export const REQUEST_FILE = 'REQUEST';
|
|
74
|
+
export const MOBIUS_SOCKET_MAPPER_FILE = 'mobiusSocketMapper';
|
|
75
|
+
export const WS_FEATURE_FLAG_FILE = 'wsFeatureFlag';
|
|
72
76
|
export const CODEC_ID = 'codecId';
|
|
73
77
|
export const MEDIA_ID = 'id';
|
|
74
78
|
export const RTC_ICE_CANDIDATE_PAIR = 'RTCIceCandidatePair_';
|
|
@@ -127,6 +131,9 @@ export const MOBIUS_EU_INT = 'mobius-eu-central-1.int.infra.webex.com';
|
|
|
127
131
|
export const FAILOVER_CACHE_PREFIX = 'wxc-failover-state';
|
|
128
132
|
export const ACTIVE_MOBIUS_STORAGE_KEY = 'wxc-active-mobius';
|
|
129
133
|
export const ICE_CANDIDATES_TIMEOUT = 3000;
|
|
134
|
+
export const ICE_LITE_CANDIDATES_TIMEOUT = 500;
|
|
135
|
+
export const WCC_CALLING_RTMS_DOMAIN = 'wcc-calling-rtms-domain';
|
|
136
|
+
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
137
|
export const METHODS = {
|
|
131
138
|
CONSTRUCTOR: 'constructor',
|
|
132
139
|
CREATE_CALL: 'createCall',
|
|
@@ -179,6 +186,7 @@ export const METHODS = {
|
|
|
179
186
|
POST_MEDIA: 'postMedia',
|
|
180
187
|
MEDIA_ROAP_EVENTS_LISTENER: 'mediaRoapEventsListener',
|
|
181
188
|
MEDIA_TRACK_LISTENER: 'mediaTrackListener',
|
|
189
|
+
MEDIA_ICE_EVENTS_LISTENER: 'mediaIceEventsListener',
|
|
182
190
|
ON_EFFECT_ENABLED: 'onEffectEnabled',
|
|
183
191
|
ON_EFFECT_DISABLED: 'onEffectDisabled',
|
|
184
192
|
UPDATE_TRACK: 'updateTrack',
|
|
@@ -230,4 +238,24 @@ export const METHODS = {
|
|
|
230
238
|
UPLOAD_LOGS: 'uploadLogs',
|
|
231
239
|
GET_SDK_CONNECTOR: 'getSDKConnector',
|
|
232
240
|
GET_CONNECTED_CALL: 'getConnectedCall',
|
|
241
|
+
CONNECT_TO_MOBIUS_SOCKET: 'connectToMobiusSocket',
|
|
242
|
+
SET_SOCKET_ENABLED: 'setSocketEnabled',
|
|
243
|
+
REGISTER_MOBIUS_SOCKET_LISTENER: 'registerMobiusSocketListener',
|
|
244
|
+
UNREGISTER_MOBIUS_SOCKET_LISTENER: 'unregisterMobiusSocketListener',
|
|
245
|
+
REGISTER_MOBIUS_SOCKET_CONNECTION_LISTENER: 'registerMobiusSocketConnectionListener',
|
|
246
|
+
UNREGISTER_MOBIUS_SOCKET_CONNECTION_LISTENER: 'unregisterMobiusSocketConnectionListener',
|
|
247
|
+
HANDLE_MOBIUS_ASYNC_EVENT: 'handleMobiusAsyncEvent',
|
|
248
|
+
HANDLE_REGISTRATION_DOWN_EVENT: 'handleRegistrationDownEvent',
|
|
249
|
+
DISCONNECT_FROM_MOBIUS_SOCKET: 'disconnectFromMobiusSocket',
|
|
250
|
+
MAKE_REQUEST: 'makeRequest',
|
|
251
|
+
DERIVE_MOBIUS_SOCKET_MESSAGE_TYPE: 'deriveMobiusSocketMessageType',
|
|
252
|
+
IS_MOBIUS_WSS_ENABLED: 'isMobiusWssEnabled',
|
|
253
|
+
RESTORE_PREVIOUS_REGISTRATION: 'restorePreviousRegistration',
|
|
254
|
+
RESTART_REGISTRATION: 'restartRegistration',
|
|
255
|
+
TRIGGER_REGISTRATION: 'triggerRegistration',
|
|
256
|
+
HANDLE_404_KEEPALIVE_FAILURE: 'handle404KeepaliveFailure',
|
|
257
|
+
HANDLE_409_KEEPALIVE_FAILURE: 'handle409KeepaliveFailure',
|
|
258
|
+
INITIATE_FAILBACK: 'initiateFailback',
|
|
259
|
+
EXECUTE_FAILBACK: 'executeFailback',
|
|
260
|
+
GET_RTMS_DOMAIN: 'getRTMSDomain',
|
|
233
261
|
};
|