@webex/calling 3.10.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/CallHistory/CallHistory.js +20 -11
- package/dist/module/CallSettings/UcmBackendConnector.js +21 -8
- package/dist/module/CallSettings/WxCallBackendConnector.js +10 -15
- package/dist/module/CallingClient/CallingClient.js +83 -123
- package/dist/module/CallingClient/calling/call.js +73 -58
- package/dist/module/CallingClient/calling/callManager.js +7 -0
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/registration/register.js +85 -5
- package/dist/module/CallingClient/registration/webWorker.js +2 -2
- package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
- package/dist/module/Contacts/ContactsClient.js +19 -25
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Logger/index.js +2 -2
- package/dist/module/Voicemail/BroadworksBackendConnector.js +10 -18
- package/dist/module/Voicemail/UcmBackendConnector.js +7 -11
- package/dist/module/Voicemail/Voicemail.js +42 -68
- package/dist/module/Voicemail/WxCallBackendConnector.js +14 -28
- package/dist/module/common/Utils.js +31 -5
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +4 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +4 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -0
- package/dist/types/CallingClient/registration/types.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/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Logger/index.d.ts +1 -2
- package/dist/types/Logger/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +16 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/CallHistory/CallHistory.js +0 -584
- package/dist/CallHistory/CallHistory.js.map +0 -1
- package/dist/CallHistory/CallHistory.test.js +0 -813
- package/dist/CallHistory/CallHistory.test.js.map +0 -1
- package/dist/CallHistory/callHistoryFixtures.js +0 -650
- package/dist/CallHistory/callHistoryFixtures.js.map +0 -1
- package/dist/CallHistory/constants.js +0 -38
- package/dist/CallHistory/constants.js.map +0 -1
- package/dist/CallHistory/types.js +0 -7
- package/dist/CallHistory/types.js.map +0 -1
- package/dist/CallSettings/CallSettings.js +0 -312
- package/dist/CallSettings/CallSettings.js.map +0 -1
- package/dist/CallSettings/CallSettings.test.js +0 -122
- package/dist/CallSettings/CallSettings.test.js.map +0 -1
- package/dist/CallSettings/UcmBackendConnector.js +0 -261
- package/dist/CallSettings/UcmBackendConnector.js.map +0 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +0 -321
- package/dist/CallSettings/UcmBackendConnector.test.js.map +0 -1
- package/dist/CallSettings/WxCallBackendConnector.js +0 -604
- package/dist/CallSettings/WxCallBackendConnector.js.map +0 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +0 -905
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +0 -1
- package/dist/CallSettings/constants.js +0 -31
- package/dist/CallSettings/constants.js.map +0 -1
- package/dist/CallSettings/testFixtures.js +0 -68
- package/dist/CallSettings/testFixtures.js.map +0 -1
- package/dist/CallSettings/types.js +0 -7
- package/dist/CallSettings/types.js.map +0 -1
- package/dist/CallingClient/CallingClient.js +0 -1071
- package/dist/CallingClient/CallingClient.js.map +0 -1
- package/dist/CallingClient/CallingClient.test.js +0 -1289
- package/dist/CallingClient/CallingClient.test.js.map +0 -1
- package/dist/CallingClient/callRecordFixtures.js +0 -101
- package/dist/CallingClient/callRecordFixtures.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/index.js +0 -276
- package/dist/CallingClient/calling/CallerId/index.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +0 -275
- package/dist/CallingClient/calling/CallerId/index.test.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/types.js +0 -7
- package/dist/CallingClient/calling/CallerId/types.js.map +0 -1
- package/dist/CallingClient/calling/call.js +0 -3444
- package/dist/CallingClient/calling/call.js.map +0 -1
- package/dist/CallingClient/calling/call.test.js +0 -3260
- package/dist/CallingClient/calling/call.test.js.map +0 -1
- package/dist/CallingClient/calling/callManager.js +0 -456
- package/dist/CallingClient/calling/callManager.js.map +0 -1
- package/dist/CallingClient/calling/callManager.test.js +0 -741
- package/dist/CallingClient/calling/callManager.test.js.map +0 -1
- package/dist/CallingClient/calling/index.js +0 -30
- package/dist/CallingClient/calling/index.js.map +0 -1
- package/dist/CallingClient/calling/types.js +0 -74
- package/dist/CallingClient/calling/types.js.map +0 -1
- package/dist/CallingClient/callingClientFixtures.js +0 -143
- package/dist/CallingClient/callingClientFixtures.js.map +0 -1
- package/dist/CallingClient/constants.js +0 -237
- package/dist/CallingClient/constants.js.map +0 -1
- package/dist/CallingClient/line/index.js +0 -349
- package/dist/CallingClient/line/index.js.map +0 -1
- package/dist/CallingClient/line/line.test.js +0 -327
- package/dist/CallingClient/line/line.test.js.map +0 -1
- package/dist/CallingClient/line/types.js +0 -21
- package/dist/CallingClient/line/types.js.map +0 -1
- package/dist/CallingClient/registration/index.js +0 -19
- package/dist/CallingClient/registration/index.js.map +0 -1
- package/dist/CallingClient/registration/register.js +0 -1538
- package/dist/CallingClient/registration/register.js.map +0 -1
- package/dist/CallingClient/registration/register.test.js +0 -1537
- package/dist/CallingClient/registration/register.test.js.map +0 -1
- package/dist/CallingClient/registration/registerFixtures.js +0 -36
- package/dist/CallingClient/registration/registerFixtures.js.map +0 -1
- package/dist/CallingClient/registration/types.js +0 -7
- package/dist/CallingClient/registration/types.js.map +0 -1
- package/dist/CallingClient/registration/webWorker.js +0 -130
- package/dist/CallingClient/registration/webWorker.js.map +0 -1
- package/dist/CallingClient/registration/webWorker.test.js +0 -303
- package/dist/CallingClient/registration/webWorker.test.js.map +0 -1
- package/dist/CallingClient/registration/webWorkerStr.js +0 -15
- package/dist/CallingClient/registration/webWorkerStr.js.map +0 -1
- package/dist/CallingClient/types.js +0 -7
- package/dist/CallingClient/types.js.map +0 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +0 -142
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +0 -1
- package/dist/Contacts/ContactsClient.js +0 -1215
- package/dist/Contacts/ContactsClient.js.map +0 -1
- package/dist/Contacts/ContactsClient.test.js +0 -1003
- package/dist/Contacts/ContactsClient.test.js.map +0 -1
- package/dist/Contacts/constants.js +0 -40
- package/dist/Contacts/constants.js.map +0 -1
- package/dist/Contacts/contactFixtures.js +0 -430
- package/dist/Contacts/contactFixtures.js.map +0 -1
- package/dist/Contacts/types.js +0 -43
- package/dist/Contacts/types.js.map +0 -1
- package/dist/Errors/catalog/CallError.js +0 -92
- package/dist/Errors/catalog/CallError.js.map +0 -1
- package/dist/Errors/catalog/CallingDeviceError.js +0 -86
- package/dist/Errors/catalog/CallingDeviceError.js.map +0 -1
- package/dist/Errors/catalog/ExtendedError.js +0 -44
- package/dist/Errors/catalog/ExtendedError.js.map +0 -1
- package/dist/Errors/catalog/LineError.js +0 -88
- package/dist/Errors/catalog/LineError.js.map +0 -1
- package/dist/Errors/index.js +0 -28
- package/dist/Errors/index.js.map +0 -1
- package/dist/Errors/types.js +0 -59
- package/dist/Errors/types.js.map +0 -1
- package/dist/Events/impl/index.js +0 -81
- package/dist/Events/impl/index.js.map +0 -1
- package/dist/Events/types.js +0 -107
- package/dist/Events/types.js.map +0 -1
- package/dist/Logger/index.js +0 -228
- package/dist/Logger/index.js.map +0 -1
- package/dist/Logger/index.test.js +0 -87
- package/dist/Logger/index.test.js.map +0 -1
- package/dist/Logger/types.js +0 -34
- package/dist/Logger/types.js.map +0 -1
- package/dist/Metrics/index.js +0 -535
- package/dist/Metrics/index.js.map +0 -1
- package/dist/Metrics/index.test.js +0 -463
- package/dist/Metrics/index.test.js.map +0 -1
- package/dist/Metrics/types.js +0 -64
- package/dist/Metrics/types.js.map +0 -1
- package/dist/SDKConnector/index.js +0 -103
- package/dist/SDKConnector/index.js.map +0 -1
- package/dist/SDKConnector/index.test.js +0 -9
- package/dist/SDKConnector/index.test.js.map +0 -1
- package/dist/SDKConnector/types.js +0 -7
- package/dist/SDKConnector/types.js.map +0 -1
- package/dist/SDKConnector/utils.js +0 -39
- package/dist/SDKConnector/utils.js.map +0 -1
- package/dist/SDKConnector/utils.test.js +0 -9
- package/dist/SDKConnector/utils.test.js.map +0 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +0 -707
- package/dist/Voicemail/BroadworksBackendConnector.js.map +0 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +0 -812
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/UcmBackendConnector.js +0 -632
- package/dist/Voicemail/UcmBackendConnector.js.map +0 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +0 -738
- package/dist/Voicemail/UcmBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/Voicemail.js +0 -500
- package/dist/Voicemail/Voicemail.js.map +0 -1
- package/dist/Voicemail/Voicemail.test.js +0 -391
- package/dist/Voicemail/Voicemail.test.js.map +0 -1
- package/dist/Voicemail/WxCallBackendConnector.js +0 -671
- package/dist/Voicemail/WxCallBackendConnector.js.map +0 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +0 -1199
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/constants.js +0 -61
- package/dist/Voicemail/constants.js.map +0 -1
- package/dist/Voicemail/types.js +0 -7
- package/dist/Voicemail/types.js.map +0 -1
- package/dist/Voicemail/voicemailFixture.js +0 -524
- package/dist/Voicemail/voicemailFixture.js.map +0 -1
- package/dist/api.js +0 -157
- package/dist/api.js.map +0 -1
- package/dist/common/Utils.js +0 -1451
- package/dist/common/Utils.js.map +0 -1
- package/dist/common/Utils.test.js +0 -1744
- package/dist/common/Utils.test.js.map +0 -1
- package/dist/common/constants.js +0 -60
- package/dist/common/constants.js.map +0 -1
- package/dist/common/index.js +0 -19
- package/dist/common/index.js.map +0 -1
- package/dist/common/testUtil.js +0 -982
- package/dist/common/testUtil.js.map +0 -1
- package/dist/common/types.js +0 -75
- package/dist/common/types.js.map +0 -1
- package/dist/index.js +0 -321
- package/dist/index.js.map +0 -1
|
@@ -7,7 +7,7 @@ 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, 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, 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';
|
|
@@ -51,6 +51,7 @@ export class Call extends Eventing {
|
|
|
51
51
|
receivedRoapOKSeq;
|
|
52
52
|
localAudioStream;
|
|
53
53
|
rtcMetrics;
|
|
54
|
+
callKeepaliveRetryCount = 0;
|
|
54
55
|
isMuted() {
|
|
55
56
|
return this.muted;
|
|
56
57
|
}
|
|
@@ -639,8 +640,7 @@ export class Call extends Eventing {
|
|
|
639
640
|
});
|
|
640
641
|
}
|
|
641
642
|
catch (e) {
|
|
642
|
-
|
|
643
|
-
log.error(extendedError, {
|
|
643
|
+
log.error(`Failed to setup the call: ${JSON.stringify(e)}`, {
|
|
644
644
|
file: CALL_FILE,
|
|
645
645
|
method: METHODS.HANDLE_OUTGOING_CALL_SETUP,
|
|
646
646
|
});
|
|
@@ -682,8 +682,7 @@ export class Call extends Eventing {
|
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
catch (e) {
|
|
685
|
-
|
|
686
|
-
log.error(extendedError, {
|
|
685
|
+
log.error(`Failed to put the call on hold: ${JSON.stringify(e)}`, {
|
|
687
686
|
file: CALL_FILE,
|
|
688
687
|
method: METHODS.HANDLE_CALL_HOLD,
|
|
689
688
|
});
|
|
@@ -725,8 +724,7 @@ export class Call extends Eventing {
|
|
|
725
724
|
}
|
|
726
725
|
}
|
|
727
726
|
catch (e) {
|
|
728
|
-
|
|
729
|
-
log.error(extendedError, {
|
|
727
|
+
log.error(`Failed to resume the call: ${JSON.stringify(e)}`, {
|
|
730
728
|
file: CALL_FILE,
|
|
731
729
|
method: METHODS.HANDLE_CALL_RESUME,
|
|
732
730
|
});
|
|
@@ -814,13 +812,12 @@ export class Call extends Eventing {
|
|
|
814
812
|
method: METHODS.HANDLE_OUTGOING_CALL_ALERTING,
|
|
815
813
|
});
|
|
816
814
|
}
|
|
817
|
-
catch (
|
|
818
|
-
|
|
819
|
-
log.error(extendedError, {
|
|
815
|
+
catch (e) {
|
|
816
|
+
log.error(`Failed to signal call progression: ${JSON.stringify(e)}`, {
|
|
820
817
|
file: CALL_FILE,
|
|
821
818
|
method: METHODS.HANDLE_OUTGOING_CALL_ALERTING,
|
|
822
819
|
});
|
|
823
|
-
const errData =
|
|
820
|
+
const errData = e;
|
|
824
821
|
handleCallErrors((error) => {
|
|
825
822
|
this.emit(CALL_EVENT_KEYS.CALL_ERROR, error);
|
|
826
823
|
this.submitCallErrorMetric(error);
|
|
@@ -864,13 +861,12 @@ export class Call extends Eventing {
|
|
|
864
861
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
865
862
|
});
|
|
866
863
|
}
|
|
867
|
-
catch (
|
|
868
|
-
|
|
869
|
-
log.error(extendedError, {
|
|
864
|
+
catch (e) {
|
|
865
|
+
log.error(`Failed to connect the call: ${JSON.stringify(e)}`, {
|
|
870
866
|
file: CALL_FILE,
|
|
871
867
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
872
868
|
});
|
|
873
|
-
const errData =
|
|
869
|
+
const errData = e;
|
|
874
870
|
handleCallErrors((error) => {
|
|
875
871
|
this.emit(CALL_EVENT_KEYS.CALL_ERROR, error);
|
|
876
872
|
this.submitCallErrorMetric(error);
|
|
@@ -886,20 +882,21 @@ export class Call extends Eventing {
|
|
|
886
882
|
async handleIncomingCallDisconnect(event) {
|
|
887
883
|
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
|
|
888
884
|
file: CALL_FILE,
|
|
889
|
-
method: METHODS.
|
|
885
|
+
method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
|
|
890
886
|
});
|
|
887
|
+
this.emit(CALL_EVENT_KEYS.DISCONNECT, this.correlationId);
|
|
891
888
|
this.setDisconnectReason();
|
|
892
889
|
try {
|
|
893
890
|
const response = await this.delete();
|
|
894
891
|
log.log(`Response code: ${response.statusCode}`, {
|
|
895
892
|
file: CALL_FILE,
|
|
896
|
-
method: METHODS.
|
|
893
|
+
method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
|
|
897
894
|
});
|
|
898
895
|
}
|
|
899
896
|
catch (e) {
|
|
900
|
-
log.warn(
|
|
897
|
+
log.warn(`Failed to delete the call: ${JSON.stringify(e)}`, {
|
|
901
898
|
file: CALL_FILE,
|
|
902
|
-
method: METHODS.
|
|
899
|
+
method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
|
|
903
900
|
});
|
|
904
901
|
uploadLogs({
|
|
905
902
|
correlationId: this.correlationId,
|
|
@@ -921,7 +918,6 @@ export class Call extends Eventing {
|
|
|
921
918
|
}
|
|
922
919
|
this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
|
|
923
920
|
this.sendCallStateMachineEvt({ type: 'E_CALL_CLEARED' });
|
|
924
|
-
this.emit(CALL_EVENT_KEYS.DISCONNECT, this.correlationId);
|
|
925
921
|
}
|
|
926
922
|
async handleOutgoingCallDisconnect(event) {
|
|
927
923
|
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
|
|
@@ -966,50 +962,70 @@ export class Call extends Eventing {
|
|
|
966
962
|
this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
|
|
967
963
|
this.sendCallStateMachineEvt({ type: 'E_CALL_CLEARED' });
|
|
968
964
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
method: METHODS.HANDLE_CALL_ESTABLISHED,
|
|
973
|
-
});
|
|
974
|
-
this.emit(CALL_EVENT_KEYS.ESTABLISHED, this.correlationId);
|
|
975
|
-
this.earlyMedia = false;
|
|
976
|
-
this.connected = true;
|
|
977
|
-
if (this.sessionTimer) {
|
|
978
|
-
log.log('Resetting session timer', {
|
|
965
|
+
callKeepaliveRetryCallback = (interval) => {
|
|
966
|
+
if (this.callKeepaliveRetryCount === MAX_CALL_KEEPALIVE_RETRY_COUNT) {
|
|
967
|
+
log.warn(`Max keepalive retry attempts reached. Aborting call keepalive for callId: ${this.callId}`, {
|
|
979
968
|
file: CALL_FILE,
|
|
980
|
-
method:
|
|
969
|
+
method: 'keepaliveRetryCallback',
|
|
981
970
|
});
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
this.callKeepaliveRetryCount += 1;
|
|
974
|
+
setTimeout(async () => {
|
|
975
|
+
try {
|
|
976
|
+
await this.postStatus();
|
|
977
|
+
this.scheduleCallKeepaliveInterval();
|
|
978
|
+
}
|
|
979
|
+
catch (err) {
|
|
980
|
+
await this.handleCallKeepaliveError(err);
|
|
981
|
+
}
|
|
982
|
+
}, interval * 1000);
|
|
983
|
+
};
|
|
984
|
+
handleCallKeepaliveError = async (err) => {
|
|
985
|
+
const error = err;
|
|
986
|
+
if (this.sessionTimer) {
|
|
982
987
|
clearInterval(this.sessionTimer);
|
|
983
988
|
}
|
|
989
|
+
const abort = await handleCallErrors((callError) => {
|
|
990
|
+
this.emit(CALL_EVENT_KEYS.CALL_ERROR, callError);
|
|
991
|
+
this.submitCallErrorMetric(callError);
|
|
992
|
+
}, ERROR_LAYER.CALL_CONTROL, this.callKeepaliveRetryCallback, this.getCorrelationId(), error, 'handleCallEstablished', CALL_FILE);
|
|
993
|
+
if (abort) {
|
|
994
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_DISCONNECT' });
|
|
995
|
+
this.emit(CALL_EVENT_KEYS.DISCONNECT, this.getCorrelationId());
|
|
996
|
+
this.callKeepaliveRetryCount = 0;
|
|
997
|
+
}
|
|
998
|
+
await uploadLogs({
|
|
999
|
+
correlationId: this.correlationId,
|
|
1000
|
+
callId: this.callId,
|
|
1001
|
+
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1002
|
+
});
|
|
1003
|
+
};
|
|
1004
|
+
scheduleCallKeepaliveInterval = () => {
|
|
1005
|
+
const loggerContext = {
|
|
1006
|
+
file: CALL_FILE,
|
|
1007
|
+
method: 'scheduleCallKeepaliveInterval',
|
|
1008
|
+
};
|
|
984
1009
|
this.sessionTimer = setInterval(async () => {
|
|
985
1010
|
try {
|
|
986
1011
|
const res = await this.postStatus();
|
|
987
|
-
log.info(`Session refresh successful`,
|
|
988
|
-
file: CALL_FILE,
|
|
989
|
-
method: METHODS.HANDLE_CALL_ESTABLISHED,
|
|
990
|
-
});
|
|
1012
|
+
log.info(`Session refresh successful`, loggerContext);
|
|
991
1013
|
}
|
|
992
1014
|
catch (err) {
|
|
993
|
-
|
|
994
|
-
if (this.sessionTimer) {
|
|
995
|
-
clearInterval(this.sessionTimer);
|
|
996
|
-
}
|
|
997
|
-
handleCallErrors((callError) => {
|
|
998
|
-
this.emit(CALL_EVENT_KEYS.CALL_ERROR, callError);
|
|
999
|
-
this.submitCallErrorMetric(callError);
|
|
1000
|
-
}, ERROR_LAYER.CALL_CONTROL, (interval) => {
|
|
1001
|
-
setTimeout(() => {
|
|
1002
|
-
this.postStatus();
|
|
1003
|
-
this.sendCallStateMachineEvt({ type: 'E_CALL_ESTABLISHED' });
|
|
1004
|
-
}, interval * 1000);
|
|
1005
|
-
}, this.getCorrelationId(), error, this.handleCallEstablished.name, CALL_FILE);
|
|
1006
|
-
await uploadLogs({
|
|
1007
|
-
correlationId: this.correlationId,
|
|
1008
|
-
callId: this.callId,
|
|
1009
|
-
broadworksCorrelationInfo: this.broadworksCorrelationInfo,
|
|
1010
|
-
});
|
|
1015
|
+
await this.handleCallKeepaliveError(err);
|
|
1011
1016
|
}
|
|
1012
1017
|
}, DEFAULT_SESSION_TIMER);
|
|
1018
|
+
};
|
|
1019
|
+
handleCallEstablished(event) {
|
|
1020
|
+
const loggerContext = {
|
|
1021
|
+
file: CALL_FILE,
|
|
1022
|
+
method: METHODS.HANDLE_CALL_ESTABLISHED,
|
|
1023
|
+
};
|
|
1024
|
+
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, loggerContext);
|
|
1025
|
+
this.emit(CALL_EVENT_KEYS.ESTABLISHED, this.correlationId);
|
|
1026
|
+
this.earlyMedia = false;
|
|
1027
|
+
this.connected = true;
|
|
1028
|
+
this.scheduleCallKeepaliveInterval();
|
|
1013
1029
|
}
|
|
1014
1030
|
async handleUnknownState(event) {
|
|
1015
1031
|
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
|
|
@@ -1164,7 +1180,7 @@ export class Call extends Eventing {
|
|
|
1164
1180
|
method: METHODS.HANDLE_ROAP_ERROR,
|
|
1165
1181
|
});
|
|
1166
1182
|
const message = event.data;
|
|
1167
|
-
if (message) {
|
|
1183
|
+
if (message && message.messageType === 'ERROR') {
|
|
1168
1184
|
try {
|
|
1169
1185
|
const res = await this.postMedia(message);
|
|
1170
1186
|
log.info(`Response code: ${res.statusCode}`, {
|
|
@@ -1219,7 +1235,7 @@ export class Call extends Eventing {
|
|
|
1219
1235
|
});
|
|
1220
1236
|
}
|
|
1221
1237
|
catch (err) {
|
|
1222
|
-
log.warn('Failed to
|
|
1238
|
+
log.warn('Failed to send MediaOffer request', {
|
|
1223
1239
|
file: CALL_FILE,
|
|
1224
1240
|
method: METHODS.HANDLE_OUTGOING_ROAP_OFFER,
|
|
1225
1241
|
});
|
|
@@ -1332,9 +1348,8 @@ export class Call extends Eventing {
|
|
|
1332
1348
|
}
|
|
1333
1349
|
catch (error) {
|
|
1334
1350
|
const errorInfo = error;
|
|
1335
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
1336
|
-
|
|
1337
|
-
log.error(errorLog, loggerContext);
|
|
1351
|
+
const errorStatus = await serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
1352
|
+
log.error(`Failed to upload webrtc telemetry statistics. ${JSON.stringify(errorStatus)}`, loggerContext);
|
|
1338
1353
|
await uploadLogs({
|
|
1339
1354
|
correlationId: this.correlationId,
|
|
1340
1355
|
callId: this.callId,
|
|
@@ -137,6 +137,13 @@ export class CallManager extends Eventing {
|
|
|
137
137
|
method: METHODS.DEQUEUE_WS_EVENTS,
|
|
138
138
|
});
|
|
139
139
|
const call = this.getCall(correlationId);
|
|
140
|
+
if (mobiusEvent.data.callerId) {
|
|
141
|
+
log.info('Processing Caller-Id data', {
|
|
142
|
+
file: CALL_MANAGER_FILE,
|
|
143
|
+
method: METHODS.DEQUEUE_WS_EVENTS,
|
|
144
|
+
});
|
|
145
|
+
call.startCallerIdResolution(mobiusEvent.data.callerId);
|
|
146
|
+
}
|
|
140
147
|
call.sendCallStateMachineEvt({ type: 'E_RECV_CALL_PROGRESS', data: mobiusEvent.data });
|
|
141
148
|
break;
|
|
142
149
|
}
|
|
@@ -12,6 +12,7 @@ export const DEFAULT_LOCAL_CALL_ID = 'DefaultLocalId';
|
|
|
12
12
|
export const DEFAULT_REHOMING_INTERVAL_MAX = 120;
|
|
13
13
|
export const DEFAULT_REHOMING_INTERVAL_MIN = 60;
|
|
14
14
|
export const DEFAULT_SESSION_TIMER = 1000 * 60 * 10;
|
|
15
|
+
export const MAX_CALL_KEEPALIVE_RETRY_COUNT = 4;
|
|
15
16
|
export const DEVICES_ENDPOINT_RESOURCE = 'devices';
|
|
16
17
|
export const DISCOVERY_URL = 'https://ds.ciscospark.com/v1/region';
|
|
17
18
|
export const DUMMY_METRICS = {
|
|
@@ -112,6 +113,7 @@ export const REGISTRATION_UTIL = 'triggerRegistration';
|
|
|
112
113
|
export const REGISTER_UTIL = 'attemptRegistrationWithServers';
|
|
113
114
|
export const GET_MOBIUS_SERVERS_UTIL = 'getMobiusServers';
|
|
114
115
|
export const KEEPALIVE_UTIL = 'startKeepaliveTimer';
|
|
116
|
+
export const RECONNECT_ON_FAILURE_UTIL = 'reconnectOnFailure';
|
|
115
117
|
export const FAILBACK_UTIL = 'executeFailback';
|
|
116
118
|
export const REG_429_RETRY_UTIL = 'handle429Retry';
|
|
117
119
|
export const FAILOVER_UTIL = 'startFailoverTimer';
|
|
@@ -122,6 +124,7 @@ export const MOBIUS_US_PROD = 'mobius-us-east-1.prod.infra.webex.com';
|
|
|
122
124
|
export const MOBIUS_EU_PROD = 'mobius-eu-central-1.prod.infra.webex.com';
|
|
123
125
|
export const MOBIUS_US_INT = 'mobius-us-east-1.int.infra.webex.com';
|
|
124
126
|
export const MOBIUS_EU_INT = 'mobius-eu-central-1.int.infra.webex.com';
|
|
127
|
+
export const FAILOVER_CACHE_PREFIX = 'wxc-failover-state';
|
|
125
128
|
export const ICE_CANDIDATES_TIMEOUT = 3000;
|
|
126
129
|
export const METHODS = {
|
|
127
130
|
CONSTRUCTOR: 'constructor',
|
|
@@ -8,7 +8,7 @@ import { getCallManager } from '../calling';
|
|
|
8
8
|
import log from '../../Logger';
|
|
9
9
|
import SDKConnector from '../../SDKConnector';
|
|
10
10
|
import { ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, ServiceIndicator, WorkerMessageType, } from '../../common/types';
|
|
11
|
-
import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, WEBEX_WEB_CLIENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, FAILOVER_UTIL, REGISTER_UTIL, RETRY_TIMER_UPPER_LIMIT, KEEPALIVE_UTIL, REGISTRATION_UTIL, METHODS, URL_ENDPOINT, } from '../constants';
|
|
11
|
+
import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, WEBEX_WEB_CLIENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, FAILOVER_UTIL, REGISTER_UTIL, RETRY_TIMER_UPPER_LIMIT, KEEPALIVE_UTIL, REGISTRATION_UTIL, METHODS, URL_ENDPOINT, RECONNECT_ON_FAILURE_UTIL, FAILOVER_CACHE_PREFIX, } from '../constants';
|
|
12
12
|
import { LINE_EVENTS } from '../line/types';
|
|
13
13
|
export class Registration {
|
|
14
14
|
sdkConnector;
|
|
@@ -58,6 +58,53 @@ export class Registration {
|
|
|
58
58
|
this.primaryMobiusUris = [];
|
|
59
59
|
this.backupMobiusUris = [];
|
|
60
60
|
}
|
|
61
|
+
getFailoverCacheKey() {
|
|
62
|
+
return `${FAILOVER_CACHE_PREFIX}.${this.userId || 'unknown'}`;
|
|
63
|
+
}
|
|
64
|
+
saveFailoverState(failoverState) {
|
|
65
|
+
try {
|
|
66
|
+
localStorage.setItem(this.getFailoverCacheKey(), JSON.stringify(failoverState));
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
log.warn(`Storing failover state in cache failed with error: ${String(error)}`, {
|
|
70
|
+
file: REGISTRATION_FILE,
|
|
71
|
+
method: 'saveFailoverState',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
clearFailoverState() {
|
|
76
|
+
try {
|
|
77
|
+
localStorage.removeItem(this.getFailoverCacheKey());
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
log.warn('Clearing failover state from localStorage failed', {
|
|
81
|
+
file: REGISTRATION_FILE,
|
|
82
|
+
method: 'clearFailoverState',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async resumeFailover() {
|
|
87
|
+
try {
|
|
88
|
+
const cachedState = localStorage.getItem(this.getFailoverCacheKey());
|
|
89
|
+
const failoverState = cachedState
|
|
90
|
+
? JSON.parse(cachedState)
|
|
91
|
+
: undefined;
|
|
92
|
+
if (failoverState && !this.isDeviceRegistered()) {
|
|
93
|
+
const currentTime = Math.floor(Date.now() / 1000);
|
|
94
|
+
const newElapsed = failoverState.timeElapsed + (currentTime - failoverState.retryScheduledTime);
|
|
95
|
+
this.clearFailoverState();
|
|
96
|
+
await this.startFailoverTimer(failoverState.attempt, newElapsed);
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
log.warn(`No failover state found in cache`, {
|
|
102
|
+
file: REGISTRATION_FILE,
|
|
103
|
+
method: 'triggerRegistration',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
61
108
|
getActiveMobiusUrl() {
|
|
62
109
|
return this.activeMobiusUrl;
|
|
63
110
|
}
|
|
@@ -88,7 +135,7 @@ export class Registration {
|
|
|
88
135
|
});
|
|
89
136
|
}
|
|
90
137
|
catch (error) {
|
|
91
|
-
log.warn(`Delete failed with Mobius ${error}`, {
|
|
138
|
+
log.warn(`Delete failed with Mobius: ${JSON.stringify(error)}`, {
|
|
92
139
|
file: REGISTRATION_FILE,
|
|
93
140
|
method: METHODS.DELETE_REGISTRATION,
|
|
94
141
|
});
|
|
@@ -119,6 +166,22 @@ export class Registration {
|
|
|
119
166
|
let abort = false;
|
|
120
167
|
if (this.activeMobiusUrl) {
|
|
121
168
|
abort = await this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
|
|
169
|
+
if (this.retryAfter) {
|
|
170
|
+
if (this.retryAfter < RETRY_TIMER_UPPER_LIMIT) {
|
|
171
|
+
setTimeout(async () => {
|
|
172
|
+
await this.restartRegistration(caller);
|
|
173
|
+
}, this.retryAfter * 1000);
|
|
174
|
+
}
|
|
175
|
+
else if (this.primaryMobiusUris.includes(this.activeMobiusUrl) &&
|
|
176
|
+
this.backupMobiusUris.length > 0) {
|
|
177
|
+
abort = await this.attemptRegistrationWithServers(caller, this.backupMobiusUris);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this.restartRegistration(caller);
|
|
181
|
+
}
|
|
182
|
+
this.retryAfter = undefined;
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
122
185
|
}
|
|
123
186
|
return abort;
|
|
124
187
|
}
|
|
@@ -190,6 +253,12 @@ export class Registration {
|
|
|
190
253
|
if (this.retryAfter != null) {
|
|
191
254
|
interval = Math.max(interval, this.retryAfter);
|
|
192
255
|
}
|
|
256
|
+
this.saveFailoverState({
|
|
257
|
+
attempt,
|
|
258
|
+
timeElapsed,
|
|
259
|
+
retryScheduledTime: scheduledTime,
|
|
260
|
+
serverType: 'primary',
|
|
261
|
+
});
|
|
193
262
|
setTimeout(async () => {
|
|
194
263
|
await this.mutex.runExclusive(async () => {
|
|
195
264
|
abort = await this.attemptRegistrationWithServers(FAILOVER_UTIL);
|
|
@@ -202,6 +271,12 @@ export class Registration {
|
|
|
202
271
|
log.log(`Scheduled retry with primary in ${interval} seconds, number of attempts : ${attempt}`, loggerContext);
|
|
203
272
|
}
|
|
204
273
|
else if (this.backupMobiusUris.length) {
|
|
274
|
+
this.saveFailoverState({
|
|
275
|
+
attempt,
|
|
276
|
+
timeElapsed,
|
|
277
|
+
retryScheduledTime: Math.floor(Date.now() / 1000),
|
|
278
|
+
serverType: 'backup',
|
|
279
|
+
});
|
|
205
280
|
log.info('Failing over to backup servers.', loggerContext);
|
|
206
281
|
this.failoverImmediately = false;
|
|
207
282
|
abort = await this.attemptRegistrationWithServers(FAILOVER_UTIL, this.backupMobiusUris);
|
|
@@ -262,7 +337,7 @@ export class Registration {
|
|
|
262
337
|
}
|
|
263
338
|
}
|
|
264
339
|
catch (error) {
|
|
265
|
-
log.warn(`Ping failed for primary Mobius: ${mobiusUrl} with error: ${error}`, {
|
|
340
|
+
log.warn(`Ping failed for primary Mobius: ${mobiusUrl} with error: ${JSON.stringify(error)}`, {
|
|
266
341
|
file: REGISTRATION_FILE,
|
|
267
342
|
method: FAILBACK_UTIL,
|
|
268
343
|
});
|
|
@@ -417,6 +492,9 @@ export class Registration {
|
|
|
417
492
|
};
|
|
418
493
|
}
|
|
419
494
|
async triggerRegistration() {
|
|
495
|
+
if (await this.resumeFailover()) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
420
498
|
if (this.primaryMobiusUris.length > 0) {
|
|
421
499
|
const abort = await this.attemptRegistrationWithServers(REGISTRATION_UTIL, this.primaryMobiusUris);
|
|
422
500
|
if (!this.isDeviceRegistered() && !abort) {
|
|
@@ -450,6 +528,7 @@ export class Registration {
|
|
|
450
528
|
method: REGISTER_UTIL,
|
|
451
529
|
});
|
|
452
530
|
const resp = await this.postRegistration(url);
|
|
531
|
+
this.clearFailoverState();
|
|
453
532
|
this.deviceInfo = resp.body;
|
|
454
533
|
this.registrationStatus = RegistrationStatus.ACTIVE;
|
|
455
534
|
this.setActiveMobiusUrl(url);
|
|
@@ -537,7 +616,7 @@ export class Registration {
|
|
|
537
616
|
this.lineEmitter(LINE_EVENTS.UNREGISTERED);
|
|
538
617
|
await uploadLogs();
|
|
539
618
|
if (!abort) {
|
|
540
|
-
await this.reconnectOnFailure(
|
|
619
|
+
await this.reconnectOnFailure(RECONNECT_ON_FAILURE_UTIL);
|
|
541
620
|
}
|
|
542
621
|
else if (error.statusCode === 404) {
|
|
543
622
|
this.handle404KeepaliveFailure(KEEPALIVE_UTIL);
|
|
@@ -571,13 +650,14 @@ export class Registration {
|
|
|
571
650
|
});
|
|
572
651
|
}
|
|
573
652
|
catch (err) {
|
|
574
|
-
log.warn(`Delete failed with Mobius: ${err}`, {
|
|
653
|
+
log.warn(`Delete failed with Mobius: ${JSON.stringify(err)}`, {
|
|
575
654
|
file: REGISTRATION_FILE,
|
|
576
655
|
method: METHODS.DEREGISTER,
|
|
577
656
|
});
|
|
578
657
|
}
|
|
579
658
|
this.clearKeepaliveTimer();
|
|
580
659
|
this.setStatus(RegistrationStatus.INACTIVE);
|
|
660
|
+
this.clearFailoverState();
|
|
581
661
|
}
|
|
582
662
|
isRegRetry() {
|
|
583
663
|
return this.registerRetry;
|
|
@@ -40,10 +40,10 @@ const messageHandler = (event) => {
|
|
|
40
40
|
}
|
|
41
41
|
catch (err) {
|
|
42
42
|
const headers = {};
|
|
43
|
-
if (err.headers
|
|
43
|
+
if (err.headers?.has('Retry-After')) {
|
|
44
44
|
headers['retry-after'] = err.headers.get('Retry-After');
|
|
45
45
|
}
|
|
46
|
-
if (err.headers
|
|
46
|
+
if (err.headers?.has('Trackingid')) {
|
|
47
47
|
headers['trackingid'] = err.headers.get('Trackingid');
|
|
48
48
|
}
|
|
49
49
|
const error = {
|
|
@@ -70,11 +70,11 @@ const messageHandler = (event) => {
|
|
|
70
70
|
keepAliveRetryCount = 0;
|
|
71
71
|
} catch (err) {
|
|
72
72
|
let headers = {};
|
|
73
|
-
if(err.headers
|
|
73
|
+
if(err.headers?.has('Retry-After')) {
|
|
74
74
|
headers['retry-after'] = err.headers.get('Retry-After');
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if(err.headers
|
|
77
|
+
if(err.headers?.has('Trackingid')) {
|
|
78
78
|
headers['trackingid'] = err.headers.get('Trackingid');
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -12,6 +12,7 @@ export class ContactsClient {
|
|
|
12
12
|
groups;
|
|
13
13
|
contacts;
|
|
14
14
|
defaultGroupId;
|
|
15
|
+
contactsServiceUrl;
|
|
15
16
|
constructor(webex, logger) {
|
|
16
17
|
this.sdkConnector = SDKConnector;
|
|
17
18
|
if (!this.sdkConnector.getWebex()) {
|
|
@@ -22,6 +23,9 @@ export class ContactsClient {
|
|
|
22
23
|
this.groups = undefined;
|
|
23
24
|
this.contacts = undefined;
|
|
24
25
|
this.defaultGroupId = '';
|
|
26
|
+
this.contactsServiceUrl =
|
|
27
|
+
this.webex.internal.services._serviceUrls?.contactsService ||
|
|
28
|
+
this.webex.internal.services.get(this.webex.internal.services._activeServices.contactsService);
|
|
25
29
|
log.setLogger(logger.level, CONTACTS_CLIENT);
|
|
26
30
|
}
|
|
27
31
|
async decryptContactDetail(encryptionKeyUrl, contactDetails) {
|
|
@@ -195,7 +199,7 @@ export class ContactsClient {
|
|
|
195
199
|
const cloudContactsMap = {};
|
|
196
200
|
try {
|
|
197
201
|
const response = await this.webex.request({
|
|
198
|
-
uri: `${this.
|
|
202
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
|
|
199
203
|
method: HTTP_METHODS.GET,
|
|
200
204
|
});
|
|
201
205
|
log.log(`Response code: ${response.statusCode} and Response trackingId: ${response?.headers?.trackingid}`, loggerContext);
|
|
@@ -250,10 +254,8 @@ export class ContactsClient {
|
|
|
250
254
|
return contactResponse;
|
|
251
255
|
}
|
|
252
256
|
catch (err) {
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
log.error(extendedError, loggerContext);
|
|
256
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
257
|
+
log.error(`Error fetching contacts: ${JSON.stringify(err)}`, loggerContext);
|
|
258
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
257
259
|
await uploadLogs();
|
|
258
260
|
return errorStatus;
|
|
259
261
|
}
|
|
@@ -374,7 +376,7 @@ export class ContactsClient {
|
|
|
374
376
|
};
|
|
375
377
|
try {
|
|
376
378
|
const response = await this.webex.request({
|
|
377
|
-
uri: `${this.
|
|
379
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}`,
|
|
378
380
|
method: HTTP_METHODS.POST,
|
|
379
381
|
body: groupInfo,
|
|
380
382
|
});
|
|
@@ -394,10 +396,8 @@ export class ContactsClient {
|
|
|
394
396
|
return contactResponse;
|
|
395
397
|
}
|
|
396
398
|
catch (err) {
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
log.error(extendedError, loggerContext);
|
|
400
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
399
|
+
log.error(`Unable to create contact group: ${JSON.stringify(err)}`, loggerContext);
|
|
400
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
401
401
|
await uploadLogs();
|
|
402
402
|
return errorStatus;
|
|
403
403
|
}
|
|
@@ -411,7 +411,7 @@ export class ContactsClient {
|
|
|
411
411
|
try {
|
|
412
412
|
log.info(`Deleting contact group: ${groupId}`, loggerContext);
|
|
413
413
|
const response = await this.webex.request({
|
|
414
|
-
uri: `${this.
|
|
414
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}/${groupId}`,
|
|
415
415
|
method: HTTP_METHODS.DELETE,
|
|
416
416
|
});
|
|
417
417
|
log.log(`Response trackingId: ${response?.headers?.trackingid}`, loggerContext);
|
|
@@ -431,10 +431,8 @@ export class ContactsClient {
|
|
|
431
431
|
return contactResponse;
|
|
432
432
|
}
|
|
433
433
|
catch (err) {
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
log.error(extendedError, loggerContext);
|
|
437
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
434
|
+
log.error(`Unable to delete contact group ${groupId}: ${JSON.stringify(err)}`, loggerContext);
|
|
435
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
438
436
|
await uploadLogs();
|
|
439
437
|
return errorStatus;
|
|
440
438
|
}
|
|
@@ -487,7 +485,7 @@ export class ContactsClient {
|
|
|
487
485
|
}
|
|
488
486
|
}
|
|
489
487
|
const response = await this.webex.request({
|
|
490
|
-
uri: `${this.
|
|
488
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
|
|
491
489
|
method: HTTP_METHODS.POST,
|
|
492
490
|
body: requestBody,
|
|
493
491
|
});
|
|
@@ -517,10 +515,8 @@ export class ContactsClient {
|
|
|
517
515
|
return contactResponse;
|
|
518
516
|
}
|
|
519
517
|
catch (err) {
|
|
520
|
-
|
|
521
|
-
const
|
|
522
|
-
log.error(extendedError, loggerContext);
|
|
523
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
518
|
+
log.error(`Failed to create contact: ${JSON.stringify(err)}`, loggerContext);
|
|
519
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
524
520
|
await uploadLogs();
|
|
525
521
|
return errorStatus;
|
|
526
522
|
}
|
|
@@ -534,7 +530,7 @@ export class ContactsClient {
|
|
|
534
530
|
try {
|
|
535
531
|
log.info(`Deleting contact : ${contactId}`, loggerContext);
|
|
536
532
|
const response = await this.webex.request({
|
|
537
|
-
uri: `${this.
|
|
533
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}/${contactId}`,
|
|
538
534
|
method: HTTP_METHODS.DELETE,
|
|
539
535
|
});
|
|
540
536
|
const contactResponse = {
|
|
@@ -550,10 +546,8 @@ export class ContactsClient {
|
|
|
550
546
|
return contactResponse;
|
|
551
547
|
}
|
|
552
548
|
catch (err) {
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
log.error(extendedError, loggerContext);
|
|
556
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
549
|
+
log.error(`Unable to delete contact ${contactId}: ${JSON.stringify(err)}`, loggerContext);
|
|
550
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
557
551
|
await uploadLogs();
|
|
558
552
|
return errorStatus;
|
|
559
553
|
}
|
|
@@ -4,7 +4,7 @@ import { LOG_PREFIX } from '../../Logger/types';
|
|
|
4
4
|
export class Eventing extends EventEmitter {
|
|
5
5
|
emit(event, ...args) {
|
|
6
6
|
const timestamp = new Date().toUTCString();
|
|
7
|
-
Logger.info(`${timestamp} ${LOG_PREFIX.EVENT}: ${event.toString()} - event emitted with parameters -> ${args}
|
|
7
|
+
Logger.info(`${timestamp} ${LOG_PREFIX.EVENT}: ${event.toString()} - event emitted with parameters -> ${args}`, {
|
|
8
8
|
file: 'Events/impl/index.ts',
|
|
9
9
|
method: 'emit',
|
|
10
10
|
});
|
|
@@ -101,9 +101,9 @@ const logTrace = (message, context) => {
|
|
|
101
101
|
writeToLogger(`${format(context, '[TRACE]')} - ${LOG_PREFIX.MESSAGE}:${message}`, LOGGER.TRACE);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
const logError = (
|
|
104
|
+
const logError = (errorMsg, context) => {
|
|
105
105
|
if (currentLogLevel >= LOGGING_LEVEL.error) {
|
|
106
|
-
writeToLogger(`${format(context, '[ERROR]')} - !${LOG_PREFIX.ERROR}!${LOG_PREFIX.MESSAGE}:${
|
|
106
|
+
writeToLogger(`${format(context, '[ERROR]')} - !${LOG_PREFIX.ERROR}!${LOG_PREFIX.MESSAGE}:${errorMsg}`, LOGGER.ERROR);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
const setWebexLogger = (logger) => {
|