@webex/calling 3.8.0 → 3.8.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/CallHistory/CallHistory.js +100 -63
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +115 -19
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallHistory/constants.js +9 -1
  6. package/dist/CallHistory/constants.js.map +1 -1
  7. package/dist/CallSettings/CallSettings.js +46 -13
  8. package/dist/CallSettings/CallSettings.js.map +1 -1
  9. package/dist/CallSettings/UcmBackendConnector.js +62 -18
  10. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.test.js +70 -7
  12. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  13. package/dist/CallSettings/WxCallBackendConnector.js +153 -103
  14. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  15. package/dist/CallSettings/WxCallBackendConnector.test.js +52 -15
  16. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  17. package/dist/CallSettings/constants.js +15 -1
  18. package/dist/CallSettings/constants.js.map +1 -1
  19. package/dist/CallingClient/CallingClient.js +220 -159
  20. package/dist/CallingClient/CallingClient.js.map +1 -1
  21. package/dist/CallingClient/CallingClient.test.js +53 -24
  22. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  23. package/dist/CallingClient/calling/call.js +251 -189
  24. package/dist/CallingClient/calling/call.js.map +1 -1
  25. package/dist/CallingClient/calling/call.test.js +96 -41
  26. package/dist/CallingClient/calling/call.test.js.map +1 -1
  27. package/dist/CallingClient/calling/callManager.js +73 -48
  28. package/dist/CallingClient/calling/callManager.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.test.js +96 -37
  30. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  31. package/dist/CallingClient/constants.js +105 -3
  32. package/dist/CallingClient/constants.js.map +1 -1
  33. package/dist/CallingClient/line/index.js +47 -18
  34. package/dist/CallingClient/line/index.js.map +1 -1
  35. package/dist/CallingClient/line/line.test.js +2 -2
  36. package/dist/CallingClient/line/line.test.js.map +1 -1
  37. package/dist/CallingClient/registration/register.js +359 -297
  38. package/dist/CallingClient/registration/register.js.map +1 -1
  39. package/dist/CallingClient/registration/register.test.js +561 -163
  40. package/dist/CallingClient/registration/register.test.js.map +1 -1
  41. package/dist/CallingClient/registration/types.js.map +1 -1
  42. package/dist/Contacts/ContactsClient.js +156 -102
  43. package/dist/Contacts/ContactsClient.js.map +1 -1
  44. package/dist/Contacts/ContactsClient.test.js +197 -49
  45. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  46. package/dist/Contacts/constants.js +11 -1
  47. package/dist/Contacts/constants.js.map +1 -1
  48. package/dist/Errors/types.js +2 -0
  49. package/dist/Errors/types.js.map +1 -1
  50. package/dist/Events/impl/index.js +1 -1
  51. package/dist/Events/impl/index.js.map +1 -1
  52. package/dist/Metrics/index.js +102 -41
  53. package/dist/Metrics/index.js.map +1 -1
  54. package/dist/Metrics/index.test.js +10 -4
  55. package/dist/Metrics/index.test.js.map +1 -1
  56. package/dist/Metrics/types.js +4 -1
  57. package/dist/Metrics/types.js.map +1 -1
  58. package/dist/SDKConnector/types.js.map +1 -1
  59. package/dist/Voicemail/BroadworksBackendConnector.js +154 -91
  60. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  61. package/dist/Voicemail/BroadworksBackendConnector.test.js +99 -19
  62. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  63. package/dist/Voicemail/UcmBackendConnector.js +105 -54
  64. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  65. package/dist/Voicemail/UcmBackendConnector.test.js +127 -17
  66. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  67. package/dist/Voicemail/Voicemail.js +198 -79
  68. package/dist/Voicemail/Voicemail.js.map +1 -1
  69. package/dist/Voicemail/Voicemail.test.js +188 -23
  70. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  71. package/dist/Voicemail/WxCallBackendConnector.js +277 -161
  72. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  73. package/dist/Voicemail/WxCallBackendConnector.test.js +268 -10
  74. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  75. package/dist/Voicemail/constants.js +25 -1
  76. package/dist/Voicemail/constants.js.map +1 -1
  77. package/dist/Voicemail/types.js.map +1 -1
  78. package/dist/common/Utils.js +168 -104
  79. package/dist/common/Utils.js.map +1 -1
  80. package/dist/common/Utils.test.js +199 -35
  81. package/dist/common/Utils.test.js.map +1 -1
  82. package/dist/common/constants.js +2 -1
  83. package/dist/common/constants.js.map +1 -1
  84. package/dist/common/testUtil.js +3 -0
  85. package/dist/common/testUtil.js.map +1 -1
  86. package/dist/common/types.js.map +1 -1
  87. package/dist/index.js +12 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/module/CallHistory/CallHistory.js +32 -13
  90. package/dist/module/CallHistory/constants.js +6 -0
  91. package/dist/module/CallSettings/CallSettings.js +36 -3
  92. package/dist/module/CallSettings/UcmBackendConnector.js +50 -5
  93. package/dist/module/CallSettings/WxCallBackendConnector.js +54 -18
  94. package/dist/module/CallSettings/constants.js +12 -0
  95. package/dist/module/CallingClient/CallingClient.js +54 -16
  96. package/dist/module/CallingClient/calling/call.js +172 -121
  97. package/dist/module/CallingClient/calling/callManager.js +51 -26
  98. package/dist/module/CallingClient/constants.js +102 -2
  99. package/dist/module/CallingClient/line/index.js +37 -8
  100. package/dist/module/CallingClient/registration/register.js +103 -64
  101. package/dist/module/Contacts/ContactsClient.js +65 -21
  102. package/dist/module/Contacts/constants.js +10 -0
  103. package/dist/module/Errors/types.js +2 -0
  104. package/dist/module/Events/impl/index.js +1 -1
  105. package/dist/module/Metrics/index.js +57 -2
  106. package/dist/module/Metrics/types.js +3 -0
  107. package/dist/module/Voicemail/BroadworksBackendConnector.js +66 -17
  108. package/dist/module/Voicemail/UcmBackendConnector.js +51 -11
  109. package/dist/module/Voicemail/Voicemail.js +109 -9
  110. package/dist/module/Voicemail/WxCallBackendConnector.js +67 -18
  111. package/dist/module/Voicemail/constants.js +21 -0
  112. package/dist/module/common/Utils.js +51 -12
  113. package/dist/module/common/constants.js +1 -0
  114. package/dist/module/common/testUtil.js +3 -0
  115. package/dist/module/index.js +1 -0
  116. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  117. package/dist/types/CallHistory/constants.d.ts +6 -0
  118. package/dist/types/CallHistory/constants.d.ts.map +1 -1
  119. package/dist/types/CallSettings/CallSettings.d.ts.map +1 -1
  120. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  121. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  122. package/dist/types/CallSettings/constants.d.ts +12 -0
  123. package/dist/types/CallSettings/constants.d.ts.map +1 -1
  124. package/dist/types/CallingClient/CallingClient.d.ts +2 -3
  125. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  126. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  127. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  128. package/dist/types/CallingClient/constants.d.ts +102 -2
  129. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  130. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  131. package/dist/types/CallingClient/registration/register.d.ts +3 -1
  132. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  133. package/dist/types/CallingClient/registration/types.d.ts +1 -0
  134. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  135. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  136. package/dist/types/Contacts/constants.d.ts +10 -0
  137. package/dist/types/Contacts/constants.d.ts.map +1 -1
  138. package/dist/types/Errors/types.d.ts +2 -0
  139. package/dist/types/Errors/types.d.ts.map +1 -1
  140. package/dist/types/Metrics/index.d.ts +1 -1
  141. package/dist/types/Metrics/index.d.ts.map +1 -1
  142. package/dist/types/Metrics/types.d.ts +7 -2
  143. package/dist/types/Metrics/types.d.ts.map +1 -1
  144. package/dist/types/SDKConnector/types.d.ts +11 -2
  145. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  146. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  147. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  148. package/dist/types/Voicemail/Voicemail.d.ts +1 -1
  149. package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
  150. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +3 -1
  151. package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
  152. package/dist/types/Voicemail/constants.d.ts +21 -0
  153. package/dist/types/Voicemail/constants.d.ts.map +1 -1
  154. package/dist/types/Voicemail/types.d.ts +1 -1
  155. package/dist/types/Voicemail/types.d.ts.map +1 -1
  156. package/dist/types/common/Utils.d.ts +4 -4
  157. package/dist/types/common/Utils.d.ts.map +1 -1
  158. package/dist/types/common/constants.d.ts +1 -0
  159. package/dist/types/common/constants.d.ts.map +1 -1
  160. package/dist/types/common/testUtil.d.ts +3 -0
  161. package/dist/types/common/testUtil.d.ts.map +1 -1
  162. package/dist/types/common/types.d.ts +12 -0
  163. package/dist/types/common/types.d.ts.map +1 -1
  164. package/dist/types/index.d.ts +2 -0
  165. package/dist/types/index.d.ts.map +1 -1
  166. package/package.json +4 -3
@@ -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, 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, 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';
@@ -16,7 +16,7 @@ import log from '../../Logger';
16
16
  import { createCallerId } from './CallerId';
17
17
  import { METRIC_TYPE, METRIC_EVENT, TRANSFER_ACTION } from '../../Metrics/types';
18
18
  import { getMetricManager } from '../../Metrics';
19
- import { SERVICES_ENDPOINT } from '../../common/constants';
19
+ import { METHOD_START_MESSAGE, SERVICES_ENDPOINT } from '../../common/constants';
20
20
  export class Call extends Eventing {
21
21
  sdkConnector;
22
22
  webex;
@@ -87,7 +87,7 @@ export class Call extends Eventing {
87
87
  this.mediaNegotiationCompleted = false;
88
88
  log.info(`Webex Calling Url:- ${this.mobiusUrl}`, {
89
89
  file: CALL_FILE,
90
- method: 'constructor',
90
+ method: METHODS.CONSTRUCTOR,
91
91
  });
92
92
  this.seq = INITIAL_SEQ_NUMBER;
93
93
  this.callerId = createCallerId(webex, (callerInfo) => {
@@ -587,7 +587,10 @@ export class Call extends Eventing {
587
587
  });
588
588
  this.callStateMachine = interpret(callMachine)
589
589
  .onTransition((state, event) => {
590
- log.log(`Call StateMachine:- state=${state.value}, event=${JSON.stringify(event.type)}`, {});
590
+ log.log(`Call StateMachine:- state=${state.value}, event=${JSON.stringify(event.type)}`, {
591
+ file: CALL_FILE,
592
+ method: METHODS.CONSTRUCTOR,
593
+ });
591
594
  if (state.value !== 'S_UNKNOWN') {
592
595
  this.metricManager.submitCallMetric(METRIC_EVENT.CALL, state.value.toString(), METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, undefined);
593
596
  }
@@ -595,7 +598,10 @@ export class Call extends Eventing {
595
598
  .start();
596
599
  this.mediaStateMachine = interpret(mediaMachine)
597
600
  .onTransition((state, event) => {
598
- log.log(`Media StateMachine:- state=${state.value}, event=${JSON.stringify(event.type)}`, {});
601
+ log.log(`Media StateMachine:- state=${state.value}, event=${JSON.stringify(event.type)}`, {
602
+ file: CALL_FILE,
603
+ method: METHODS.CONSTRUCTOR,
604
+ });
599
605
  if (state.value !== 'S_ROAP_ERROR') {
600
606
  this.metricManager.submitMediaMetric(METRIC_EVENT.MEDIA, state.value.toString(), METRIC_TYPE.BEHAVIORAL, this.callId, this.correlationId, this.localRoapMessage.sdp, this.remoteRoapMessage?.sdp, undefined);
601
607
  }
@@ -604,64 +610,69 @@ export class Call extends Eventing {
604
610
  this.muted = false;
605
611
  }
606
612
  handleIncomingCallSetup(event) {
607
- log.info(`handleIncomingCallSetup: ${this.getCorrelationId()} `, {
613
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
608
614
  file: CALL_FILE,
609
- method: this.handleIncomingCallSetup.name,
615
+ method: METHODS.HANDLE_INCOMING_CALL_SETUP,
610
616
  });
611
617
  this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_ALERTING' });
612
618
  }
613
619
  async handleOutgoingCallSetup(event) {
614
- log.info(`handleOutgoingCallSetup: ${this.getCorrelationId()} `, {
620
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
615
621
  file: CALL_FILE,
616
- method: this.handleOutgoingCallSetup.name,
622
+ method: METHODS.HANDLE_OUTGOING_CALL_SETUP,
617
623
  });
618
624
  const message = event.data;
619
625
  try {
620
626
  const response = await this.post(message);
621
- log.log(`handleOutgoingCallSetup: Response: ${JSON.stringify(response)}`, {
627
+ log.info(`Response: ${JSON.stringify(response)}`, {
622
628
  file: CALL_FILE,
623
- method: this.handleOutgoingCallSetup.name,
629
+ method: METHODS.HANDLE_OUTGOING_CALL_SETUP,
624
630
  });
625
- log.log(`handleOutgoingCallSetup: Response code: ${response.statusCode}`, {
631
+ log.info(`Response code: ${response.statusCode}`, {
626
632
  file: CALL_FILE,
627
- method: this.handleOutgoingCallSetup.name,
633
+ method: METHODS.HANDLE_OUTGOING_CALL_SETUP,
628
634
  });
629
635
  this.setCallId(response.body.callId);
636
+ log.log(`Call setup successful for callId: ${response.body.callId}`, {
637
+ file: CALL_FILE,
638
+ method: this.handleOutgoingCallSetup.name,
639
+ });
630
640
  }
631
641
  catch (e) {
632
- log.warn('Failed to setup the call', {
642
+ const extendedError = new Error(`Failed to setup the call: ${e}`);
643
+ log.error(extendedError, {
633
644
  file: CALL_FILE,
634
- method: this.handleOutgoingCallSetup.name,
645
+ method: METHODS.HANDLE_OUTGOING_CALL_SETUP,
635
646
  });
636
647
  const errData = e;
637
648
  handleCallErrors((error) => {
638
649
  this.emit(CALL_EVENT_KEYS.CALL_ERROR, error);
639
650
  this.submitCallErrorMetric(error);
640
651
  this.sendCallStateMachineEvt({ type: 'E_UNKNOWN', data: errData });
641
- }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, this.handleOutgoingCallSetup.name, CALL_FILE);
642
- uploadLogs({
652
+ }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, METHODS.HANDLE_OUTGOING_CALL_SETUP, CALL_FILE);
653
+ await uploadLogs({
643
654
  correlationId: this.correlationId,
644
655
  callId: this.callId,
645
656
  });
646
657
  }
647
658
  }
648
659
  async handleCallHold(event) {
649
- log.info(`handleCallHold: ${this.getCorrelationId()} `, {
660
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
650
661
  file: CALL_FILE,
651
- method: this.handleCallHold.name,
662
+ method: METHODS.HANDLE_CALL_HOLD,
652
663
  });
653
664
  try {
654
665
  const response = await this.postSSRequest(undefined, SUPPLEMENTARY_SERVICES.HOLD);
655
666
  log.log(`Response code: ${response.statusCode}`, {
656
667
  file: CALL_FILE,
657
- method: this.handleCallHold.name,
668
+ method: METHODS.HANDLE_CALL_HOLD,
658
669
  });
659
670
  if (this.isHeld() === false) {
660
671
  this.supplementaryServicesTimer = setTimeout(async () => {
661
- const errorContext = { file: CALL_FILE, method: this.handleCallHold.name };
672
+ const errorContext = { file: CALL_FILE, method: METHODS.HANDLE_CALL_HOLD };
662
673
  log.warn('Hold response timed out', {
663
674
  file: CALL_FILE,
664
- method: this.handleCallHold.name,
675
+ method: METHODS.HANDLE_CALL_HOLD,
665
676
  });
666
677
  const callError = createCallError('An error occurred while placing the call on hold. Wait a moment and try again.', errorContext, ERROR_TYPE.TIMEOUT, this.getCorrelationId(), ERROR_LAYER.CALL_CONTROL);
667
678
  this.emit(CALL_EVENT_KEYS.HOLD_ERROR, callError);
@@ -670,26 +681,27 @@ export class Call extends Eventing {
670
681
  }
671
682
  }
672
683
  catch (e) {
673
- log.warn('Failed to put the call on hold', {
684
+ const extendedError = new Error(`Failed to put the call on hold: ${e}`);
685
+ log.error(extendedError, {
674
686
  file: CALL_FILE,
675
- method: this.handleCallHold.name,
687
+ method: METHODS.HANDLE_CALL_HOLD,
676
688
  });
677
689
  const errData = e;
678
690
  handleCallErrors((error) => {
679
691
  this.emit(CALL_EVENT_KEYS.HOLD_ERROR, error);
680
692
  this.submitCallErrorMetric(error);
681
693
  this.sendCallStateMachineEvt({ type: 'E_CALL_ESTABLISHED', data: errData });
682
- }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, this.handleOutgoingCallSetup.name, CALL_FILE);
683
- uploadLogs({
694
+ }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, METHODS.HANDLE_CALL_HOLD, CALL_FILE);
695
+ await uploadLogs({
684
696
  correlationId: this.correlationId,
685
697
  callId: this.callId,
686
698
  });
687
699
  }
688
700
  }
689
701
  async handleCallResume(event) {
690
- log.info(`handleCallResume: ${this.getCorrelationId()} `, {
702
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
691
703
  file: CALL_FILE,
692
- method: this.handleCallResume.name,
704
+ method: METHODS.HANDLE_CALL_RESUME,
693
705
  });
694
706
  try {
695
707
  const response = await this.postSSRequest(undefined, SUPPLEMENTARY_SERVICES.RESUME);
@@ -711,7 +723,8 @@ export class Call extends Eventing {
711
723
  }
712
724
  }
713
725
  catch (e) {
714
- log.warn('Failed to resume the call', {
726
+ const extendedError = new Error(`Failed to resume the call: ${e}`);
727
+ log.error(extendedError, {
715
728
  file: CALL_FILE,
716
729
  method: this.handleCallResume.name,
717
730
  });
@@ -721,16 +734,16 @@ export class Call extends Eventing {
721
734
  this.submitCallErrorMetric(error);
722
735
  this.sendCallStateMachineEvt({ type: 'E_CALL_ESTABLISHED', data: errData });
723
736
  }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, this.handleOutgoingCallSetup.name, CALL_FILE);
724
- uploadLogs({
737
+ await uploadLogs({
725
738
  correlationId: this.correlationId,
726
739
  callId: this.callId,
727
740
  });
728
741
  }
729
742
  }
730
743
  handleIncomingCallProgress(event) {
731
- log.info(`handleIncomingCallProgress: ${this.getCorrelationId()} `, {
744
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
732
745
  file: CALL_FILE,
733
- method: this.handleIncomingCallProgress.name,
746
+ method: METHODS.HANDLE_INCOMING_CALL_PROGRESS,
734
747
  });
735
748
  const data = event.data;
736
749
  if (data?.callProgressData?.inbandMedia) {
@@ -756,9 +769,9 @@ export class Call extends Eventing {
756
769
  this.emit(CALL_EVENT_KEYS.PROGRESS, this.correlationId);
757
770
  }
758
771
  handleIncomingRoapOfferRequest(context, event) {
759
- log.info(`handleIncomingRoapOfferRequest: ${this.getCorrelationId()} `, {
772
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
760
773
  file: CALL_FILE,
761
- method: this.handleIncomingRoapOfferRequest.name,
774
+ method: METHODS.HANDLE_INCOMING_ROAP_OFFER_REQUEST,
762
775
  });
763
776
  const message = event.data;
764
777
  if (!this.mediaConnection) {
@@ -787,9 +800,9 @@ export class Call extends Eventing {
787
800
  }
788
801
  }
789
802
  async handleOutgoingCallAlerting(event) {
790
- log.info(`handleOutgoingCallAlerting: ${this.getCorrelationId()} `, {
803
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
791
804
  file: CALL_FILE,
792
- method: this.handleOutgoingCallAlerting.name,
805
+ method: METHODS.HANDLE_OUTGOING_CALL_ALERTING,
793
806
  });
794
807
  try {
795
808
  const res = await this.patch(MobiusCallState.ALERTING);
@@ -799,7 +812,8 @@ export class Call extends Eventing {
799
812
  });
800
813
  }
801
814
  catch (err) {
802
- log.warn('Failed to signal call progression', {
815
+ const extendedError = new Error(`Failed to signal call progression: ${err}`);
816
+ log.error(extendedError, {
803
817
  file: CALL_FILE,
804
818
  method: this.handleOutgoingCallAlerting.name,
805
819
  });
@@ -809,16 +823,16 @@ export class Call extends Eventing {
809
823
  this.submitCallErrorMetric(error);
810
824
  this.sendCallStateMachineEvt({ type: 'E_UNKNOWN', data: errData });
811
825
  }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, this.handleOutgoingCallAlerting.name, CALL_FILE);
812
- uploadLogs({
826
+ await uploadLogs({
813
827
  correlationId: this.correlationId,
814
828
  callId: this.callId,
815
829
  });
816
830
  }
817
831
  }
818
832
  handleIncomingCallConnect(event) {
819
- log.info(`handleIncomingCallConnect: ${this.getCorrelationId()} `, {
833
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
820
834
  file: CALL_FILE,
821
- method: this.handleIncomingCallConnect.name,
835
+ method: METHODS.HANDLE_INCOMING_CALL_CONNECT,
822
836
  });
823
837
  this.emit(CALL_EVENT_KEYS.CONNECT, this.correlationId);
824
838
  if (this.earlyMedia || this.mediaNegotiationCompleted) {
@@ -827,9 +841,9 @@ export class Call extends Eventing {
827
841
  }
828
842
  }
829
843
  async handleOutgoingCallConnect(event) {
830
- log.info(`handleOutgoingCallConnect: ${this.getCorrelationId()} `, {
844
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
831
845
  file: CALL_FILE,
832
- method: this.handleOutgoingCallConnect.name,
846
+ method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
833
847
  });
834
848
  if (!this.remoteRoapMessage) {
835
849
  log.warn('Offer not yet received from remote end... Exiting', {
@@ -847,7 +861,8 @@ export class Call extends Eventing {
847
861
  });
848
862
  }
849
863
  catch (err) {
850
- log.warn('Failed to connect the call', {
864
+ const extendedError = new Error(`Failed to connect the call: ${err}`);
865
+ log.error(extendedError, {
851
866
  file: CALL_FILE,
852
867
  method: this.handleOutgoingCallConnect.name,
853
868
  });
@@ -857,29 +872,29 @@ export class Call extends Eventing {
857
872
  this.submitCallErrorMetric(error);
858
873
  this.sendCallStateMachineEvt({ type: 'E_UNKNOWN', data: errData });
859
874
  }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, this.handleOutgoingCallConnect.name, CALL_FILE);
860
- uploadLogs({
875
+ await uploadLogs({
861
876
  correlationId: this.correlationId,
862
877
  callId: this.callId,
863
878
  });
864
879
  }
865
880
  }
866
881
  async handleIncomingCallDisconnect(event) {
867
- log.info(`handleIncomingCallDisconnect: ${this.getCorrelationId()} `, {
882
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
868
883
  file: CALL_FILE,
869
- method: this.handleIncomingCallDisconnect.name,
884
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
870
885
  });
871
886
  this.setDisconnectReason();
872
887
  try {
873
888
  const response = await this.delete();
874
- log.log(`handleOutgoingCallDisconnect: Response code: ${response.statusCode}`, {
889
+ log.log(`Response code: ${response.statusCode}`, {
875
890
  file: CALL_FILE,
876
- method: this.handleIncomingCallDisconnect.name,
891
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
877
892
  });
878
893
  }
879
894
  catch (e) {
880
895
  log.warn('Failed to delete the call', {
881
896
  file: CALL_FILE,
882
- method: this.handleIncomingCallDisconnect.name,
897
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
883
898
  });
884
899
  }
885
900
  this.deleteCb(this.correlationId);
@@ -889,25 +904,36 @@ export class Call extends Eventing {
889
904
  }
890
905
  if (this.mediaConnection) {
891
906
  this.mediaConnection.close();
892
- log.info('Closing media channel', { file: CALL_FILE, method: 'handleIncomingCallDisconnect' });
907
+ log.info('Closing media channel', {
908
+ file: CALL_FILE,
909
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
910
+ });
893
911
  }
894
912
  this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
895
913
  this.sendCallStateMachineEvt({ type: 'E_CALL_CLEARED' });
896
914
  this.emit(CALL_EVENT_KEYS.DISCONNECT, this.correlationId);
897
915
  }
898
916
  async handleOutgoingCallDisconnect(event) {
917
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
918
+ file: CALL_FILE,
919
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
920
+ });
899
921
  this.setDisconnectReason();
900
922
  try {
901
923
  const response = await this.delete();
902
- log.log(`handleOutgoingCallDisconnect: Response code: ${response.statusCode}`, {
924
+ log.log(`Response code: ${response.statusCode}`, {
903
925
  file: CALL_FILE,
904
- method: this.handleOutgoingCallDisconnect.name,
926
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
927
+ });
928
+ log.log(`Call disconnected successfully: ${this.correlationId}`, {
929
+ file: CALL_FILE,
930
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
905
931
  });
906
932
  }
907
933
  catch (e) {
908
934
  log.warn('Failed to delete the call', {
909
935
  file: CALL_FILE,
910
- method: this.handleOutgoingCallDisconnect.name,
936
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
911
937
  });
912
938
  }
913
939
  this.deleteCb(this.correlationId);
@@ -917,15 +943,18 @@ export class Call extends Eventing {
917
943
  }
918
944
  if (this.mediaConnection) {
919
945
  this.mediaConnection.close();
920
- log.info('Closing media channel', { file: CALL_FILE, method: 'handleOutgoingCallDisconnect' });
946
+ log.info('Closing media channel', {
947
+ file: CALL_FILE,
948
+ method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
949
+ });
921
950
  }
922
951
  this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
923
952
  this.sendCallStateMachineEvt({ type: 'E_CALL_CLEARED' });
924
953
  }
925
954
  handleCallEstablished(event) {
926
- log.info(`handleCallEstablished: ${this.getCorrelationId()} `, {
955
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
927
956
  file: CALL_FILE,
928
- method: this.handleCallEstablished.name,
957
+ method: METHODS.HANDLE_CALL_ESTABLISHED,
929
958
  });
930
959
  this.emit(CALL_EVENT_KEYS.ESTABLISHED, this.correlationId);
931
960
  this.earlyMedia = false;
@@ -933,7 +962,7 @@ export class Call extends Eventing {
933
962
  if (this.sessionTimer) {
934
963
  log.log('Resetting session timer', {
935
964
  file: CALL_FILE,
936
- method: 'handleCallEstablished',
965
+ method: METHODS.HANDLE_CALL_ESTABLISHED,
937
966
  });
938
967
  clearInterval(this.sessionTimer);
939
968
  }
@@ -942,7 +971,7 @@ export class Call extends Eventing {
942
971
  const res = await this.postStatus();
943
972
  log.info(`Session refresh successful`, {
944
973
  file: CALL_FILE,
945
- method: 'handleCallEstablished',
974
+ method: METHODS.HANDLE_CALL_ESTABLISHED,
946
975
  });
947
976
  }
948
977
  catch (err) {
@@ -959,7 +988,7 @@ export class Call extends Eventing {
959
988
  this.sendCallStateMachineEvt({ type: 'E_CALL_ESTABLISHED' });
960
989
  }, interval * 1000);
961
990
  }, this.getCorrelationId(), error, this.handleCallEstablished.name, CALL_FILE);
962
- uploadLogs({
991
+ await uploadLogs({
963
992
  correlationId: this.correlationId,
964
993
  callId: this.callId,
965
994
  });
@@ -967,15 +996,15 @@ export class Call extends Eventing {
967
996
  }, DEFAULT_SESSION_TIMER);
968
997
  }
969
998
  async handleUnknownState(event) {
970
- log.info(`handleUnknownState: ${this.getCorrelationId()} `, {
999
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
971
1000
  file: CALL_FILE,
972
- method: this.handleUnknownState.name,
1001
+ method: METHODS.HANDLE_UNKNOWN_STATE,
973
1002
  });
974
1003
  const eventData = event.data;
975
1004
  if (!eventData?.media) {
976
1005
  log.warn('Call failed due to signalling issue', {
977
1006
  file: CALL_FILE,
978
- method: this.handleUnknownState.name,
1007
+ method: METHODS.HANDLE_UNKNOWN_STATE,
979
1008
  });
980
1009
  }
981
1010
  try {
@@ -983,13 +1012,13 @@ export class Call extends Eventing {
983
1012
  const response = await this.delete();
984
1013
  log.log(`handleOutgoingCallDisconnect: Response code: ${response.statusCode}`, {
985
1014
  file: CALL_FILE,
986
- method: this.handleUnknownState.name,
1015
+ method: METHODS.HANDLE_UNKNOWN_STATE,
987
1016
  });
988
1017
  }
989
1018
  catch (e) {
990
1019
  log.warn('Failed to delete the call', {
991
1020
  file: CALL_FILE,
992
- method: this.handleUnknownState.name,
1021
+ method: METHODS.HANDLE_UNKNOWN_STATE,
993
1022
  });
994
1023
  }
995
1024
  this.deleteCb(this.correlationId);
@@ -1000,7 +1029,7 @@ export class Call extends Eventing {
1000
1029
  this.mediaConnection.close();
1001
1030
  log.info('Closing media channel', {
1002
1031
  file: CALL_FILE,
1003
- method: this.handleUnknownState.name,
1032
+ method: METHODS.HANDLE_UNKNOWN_STATE,
1004
1033
  });
1005
1034
  }
1006
1035
  this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
@@ -1033,31 +1062,31 @@ export class Call extends Eventing {
1033
1062
  };
1034
1063
  }
1035
1064
  async handleRoapEstablished(context, event) {
1036
- log.info(`handleRoapEstablished: ${this.getCorrelationId()} `, {
1065
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
1037
1066
  file: CALL_FILE,
1038
- method: 'handleRoapEstablished',
1067
+ method: METHODS.HANDLE_ROAP_ESTABLISHED,
1039
1068
  });
1040
1069
  const { received, message } = event.data;
1041
1070
  this.receivedRoapOKSeq = message.seq;
1042
1071
  if (!received) {
1043
1072
  log.info('Sending Media Ok to the remote End', {
1044
1073
  file: CALL_FILE,
1045
- method: 'handleRoapEstablished',
1074
+ method: METHODS.HANDLE_ROAP_ESTABLISHED,
1046
1075
  });
1047
1076
  try {
1048
1077
  if (this.callStateMachine.state.value === 'S_RECV_CALL_PROGRESS' ||
1049
1078
  this.callStateMachine.state.value === 'S_SEND_CALL_SETUP') {
1050
1079
  log.info('Media negotiation completed before call connect. Setting media negotiation completed flag.', {
1051
1080
  file: CALL_FILE,
1052
- method: 'handleRoapEstablished',
1081
+ method: METHODS.HANDLE_ROAP_ESTABLISHED,
1053
1082
  });
1054
1083
  this.mediaNegotiationCompleted = true;
1055
1084
  }
1056
1085
  message.seq = this.seq;
1057
1086
  const res = await this.postMedia(message);
1058
- log.log(`handleRoapEstablished: Response code: ${res.statusCode}`, {
1087
+ log.log(`Response code: ${res.statusCode}`, {
1059
1088
  file: CALL_FILE,
1060
- method: 'handleRoapEstablished',
1089
+ method: METHODS.HANDLE_ROAP_ESTABLISHED,
1061
1090
  });
1062
1091
  if (!this.earlyMedia && !this.mediaNegotiationCompleted) {
1063
1092
  this.sendCallStateMachineEvt({ type: 'E_CALL_ESTABLISHED' });
@@ -1066,7 +1095,7 @@ export class Call extends Eventing {
1066
1095
  catch (err) {
1067
1096
  log.warn('Failed to process MediaOk request', {
1068
1097
  file: CALL_FILE,
1069
- method: 'handleRoapEstablished',
1098
+ method: METHODS.HANDLE_ROAP_ESTABLISHED,
1070
1099
  });
1071
1100
  const errData = err;
1072
1101
  handleCallErrors(this.getEmitterCallback(errData), ERROR_LAYER.MEDIA, (interval) => {
@@ -1076,7 +1105,7 @@ export class Call extends Eventing {
1076
1105
  }, interval * 1000);
1077
1106
  }
1078
1107
  }, this.getCorrelationId(), errData, this.handleRoapEstablished.name, CALL_FILE);
1079
- uploadLogs({
1108
+ await uploadLogs({
1080
1109
  correlationId: this.correlationId,
1081
1110
  callId: this.callId,
1082
1111
  });
@@ -1085,7 +1114,7 @@ export class Call extends Eventing {
1085
1114
  else {
1086
1115
  log.info('Notifying internal-media-core about ROAP OK message', {
1087
1116
  file: CALL_FILE,
1088
- method: 'handleRoapEstablished',
1117
+ method: METHODS.HANDLE_ROAP_ESTABLISHED,
1089
1118
  });
1090
1119
  message.seq = this.seq;
1091
1120
  if (this.mediaConnection) {
@@ -1108,9 +1137,9 @@ export class Call extends Eventing {
1108
1137
  }
1109
1138
  }
1110
1139
  async handleRoapError(context, event) {
1111
- log.info(`handleRoapError: ${this.getCorrelationId()}`, {
1140
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
1112
1141
  file: CALL_FILE,
1113
- method: this.handleRoapError.name,
1142
+ method: METHODS.HANDLE_ROAP_ERROR,
1114
1143
  });
1115
1144
  const message = event.data;
1116
1145
  if (message) {
@@ -1118,20 +1147,20 @@ export class Call extends Eventing {
1118
1147
  const res = await this.postMedia(message);
1119
1148
  log.info(`Response code: ${res.statusCode}`, {
1120
1149
  file: CALL_FILE,
1121
- method: this.handleRoapError.name,
1150
+ method: METHODS.HANDLE_ROAP_ERROR,
1122
1151
  });
1123
1152
  }
1124
1153
  catch (err) {
1125
1154
  log.warn('Failed to communicate ROAP error to Webex Calling', {
1126
1155
  file: CALL_FILE,
1127
- method: this.handleRoapError.name,
1156
+ method: METHODS.HANDLE_ROAP_ERROR,
1128
1157
  });
1129
1158
  const errData = err;
1130
1159
  handleCallErrors((error) => {
1131
1160
  this.emit(CALL_EVENT_KEYS.CALL_ERROR, error);
1132
1161
  this.submitCallErrorMetric(error);
1133
1162
  }, ERROR_LAYER.MEDIA, (interval) => undefined, this.getCorrelationId(), errData, this.handleRoapError.name, CALL_FILE);
1134
- uploadLogs({
1163
+ await uploadLogs({
1135
1164
  correlationId: this.correlationId,
1136
1165
  callId: this.callId,
1137
1166
  });
@@ -1140,15 +1169,15 @@ export class Call extends Eventing {
1140
1169
  if (!this.connected) {
1141
1170
  log.warn('Call failed due to media issue', {
1142
1171
  file: CALL_FILE,
1143
- method: 'handleRoapError',
1172
+ method: METHODS.HANDLE_ROAP_ERROR,
1144
1173
  });
1145
1174
  this.sendCallStateMachineEvt({ type: 'E_UNKNOWN', data: { media: true } });
1146
1175
  }
1147
1176
  }
1148
1177
  async handleOutgoingRoapOffer(context, event) {
1149
- log.info(`handleOutgoingRoapOffer: ${this.getCorrelationId()}`, {
1178
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
1150
1179
  file: CALL_FILE,
1151
- method: this.handleOutgoingRoapOffer.name,
1180
+ method: METHODS.HANDLE_OUTGOING_ROAP_OFFER,
1152
1181
  });
1153
1182
  const message = event.data;
1154
1183
  if (!message?.sdp) {
@@ -1179,16 +1208,16 @@ export class Call extends Eventing {
1179
1208
  }, interval * 1000);
1180
1209
  }
1181
1210
  }, this.getCorrelationId(), errData, this.handleOutgoingRoapOffer.name, CALL_FILE);
1182
- uploadLogs({
1211
+ await uploadLogs({
1183
1212
  correlationId: this.correlationId,
1184
1213
  callId: this.callId,
1185
1214
  });
1186
1215
  }
1187
1216
  }
1188
1217
  async handleOutgoingRoapAnswer(context, event) {
1189
- log.info(`handleOutgoingRoapAnswer: ${this.getCorrelationId()}`, {
1218
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
1190
1219
  file: CALL_FILE,
1191
- method: this.handleOutgoingRoapAnswer.name,
1220
+ method: METHODS.HANDLE_OUTGOING_ROAP_ANSWER,
1192
1221
  });
1193
1222
  const message = event.data;
1194
1223
  try {
@@ -1212,16 +1241,16 @@ export class Call extends Eventing {
1212
1241
  }, interval * 1000);
1213
1242
  }
1214
1243
  }, this.getCorrelationId(), errData, this.handleOutgoingRoapAnswer.name, CALL_FILE);
1215
- uploadLogs({
1244
+ await uploadLogs({
1216
1245
  correlationId: this.correlationId,
1217
1246
  callId: this.callId,
1218
1247
  });
1219
1248
  }
1220
1249
  }
1221
1250
  handleIncomingRoapOffer(context, event) {
1222
- log.info(`handleIncomingRoapOffer: ${this.getCorrelationId()}`, {
1251
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
1223
1252
  file: CALL_FILE,
1224
- method: this.handleIncomingRoapOffer.name,
1253
+ method: METHODS.HANDLE_INCOMING_ROAP_OFFER,
1225
1254
  });
1226
1255
  const message = event.data;
1227
1256
  this.remoteRoapMessage = message;
@@ -1255,9 +1284,9 @@ export class Call extends Eventing {
1255
1284
  }
1256
1285
  }
1257
1286
  handleIncomingRoapAnswer(context, event) {
1258
- log.info(`handleIncomingRoapAnswer: ${this.getCorrelationId()}`, {
1287
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
1259
1288
  file: CALL_FILE,
1260
- method: this.handleIncomingRoapAnswer.name,
1289
+ method: METHODS.HANDLE_INCOMING_ROAP_ANSWER,
1261
1290
  });
1262
1291
  const message = event.data;
1263
1292
  this.remoteRoapMessage = message;
@@ -1269,7 +1298,7 @@ export class Call extends Eventing {
1269
1298
  forceSendStatsReport = async ({ callFrom }) => {
1270
1299
  const loggerContext = {
1271
1300
  file: CALL_FILE,
1272
- method: this.forceSendStatsReport.name,
1301
+ method: METHODS.FORCE_SEND_STATS_REPORT,
1273
1302
  };
1274
1303
  try {
1275
1304
  await this.mediaConnection.forceRtcMetricsSend();
@@ -1281,6 +1310,10 @@ export class Call extends Eventing {
1281
1310
  const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
1282
1311
  const errorLog = new Error(`Failed to upload webrtc telemetry statistics. ${errorStatus}`);
1283
1312
  log.error(errorLog, loggerContext);
1313
+ await uploadLogs({
1314
+ correlationId: this.correlationId,
1315
+ callId: this.callId,
1316
+ });
1284
1317
  }
1285
1318
  };
1286
1319
  initMediaConnection(localAudioTrack, debugId) {
@@ -1317,8 +1350,10 @@ export class Call extends Eventing {
1317
1350
  this.rtcMetrics.updateCallId(callId);
1318
1351
  log.info(`Setting callId : ${this.callId} for correlationId: ${this.correlationId}`, {
1319
1352
  file: CALL_FILE,
1320
- method: this.setCallId.name,
1353
+ method: METHODS.SET_CALL_ID,
1321
1354
  });
1355
+ this.callId = callId;
1356
+ this.rtcMetrics.updateCallId(callId);
1322
1357
  };
1323
1358
  setDisconnectReason() {
1324
1359
  if (this.mediaInactivity) {
@@ -1338,12 +1373,16 @@ export class Call extends Eventing {
1338
1373
  return this.disconnectReason;
1339
1374
  };
1340
1375
  async answer(localAudioStream) {
1376
+ log.info(`${METHOD_START_MESSAGE} with stream`, {
1377
+ file: CALL_FILE,
1378
+ method: METHODS.ANSWER,
1379
+ });
1341
1380
  this.localAudioStream = localAudioStream;
1342
1381
  const localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
1343
1382
  if (!localAudioTrack) {
1344
1383
  log.warn(`Did not find a local track while answering the call ${this.getCorrelationId()}`, {
1345
1384
  file: CALL_FILE,
1346
- method: 'answer',
1385
+ method: METHODS.ANSWER,
1347
1386
  });
1348
1387
  this.mediaInactivity = true;
1349
1388
  this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_DISCONNECT' });
@@ -1360,16 +1399,20 @@ export class Call extends Eventing {
1360
1399
  this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_CONNECT' });
1361
1400
  }
1362
1401
  else {
1363
- log.warn(`Call cannot be answered because the state is : ${this.callStateMachine.state.value}`, { file: CALL_FILE, method: 'answer' });
1402
+ log.warn(`Call cannot be answered because the state is : ${this.callStateMachine.state.value}`, { file: CALL_FILE, method: METHODS.ANSWER });
1364
1403
  }
1365
1404
  }
1366
1405
  async dial(localAudioStream) {
1406
+ log.info(`${METHOD_START_MESSAGE} with stream`, {
1407
+ file: CALL_FILE,
1408
+ method: METHODS.DIAL,
1409
+ });
1367
1410
  this.localAudioStream = localAudioStream;
1368
1411
  const localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
1369
1412
  if (!localAudioTrack) {
1370
1413
  log.warn(`Did not find a local track while dialing the call ${this.getCorrelationId()}`, {
1371
1414
  file: CALL_FILE,
1372
- method: 'dial',
1415
+ method: METHODS.DIAL,
1373
1416
  });
1374
1417
  this.deleteCb(this.getCorrelationId());
1375
1418
  this.emit(CALL_EVENT_KEYS.DISCONNECT, this.getCorrelationId());
@@ -1386,7 +1429,7 @@ export class Call extends Eventing {
1386
1429
  this.sendMediaStateMachineEvt({ type: 'E_SEND_ROAP_OFFER' });
1387
1430
  }
1388
1431
  else {
1389
- log.warn(`Call cannot be dialed because the state is already : ${this.mediaStateMachine.state.value}`, { file: CALL_FILE, method: 'dial' });
1432
+ log.warn(`Call cannot be dialed because the state is already : ${this.mediaStateMachine.state.value}`, { file: CALL_FILE, method: METHODS.DIAL });
1390
1433
  }
1391
1434
  }
1392
1435
  post = async (roapMessage) => {
@@ -1533,7 +1576,7 @@ export class Call extends Eventing {
1533
1576
  this.emit(CALL_EVENT_KEYS.TRANSFER_ERROR, error);
1534
1577
  this.submitCallErrorMetric(error, TRANSFER_ACTION.BLIND);
1535
1578
  }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, this.completeTransfer.name, CALL_FILE);
1536
- uploadLogs({
1579
+ await uploadLogs({
1537
1580
  correlationId: this.correlationId,
1538
1581
  callId: this.callId,
1539
1582
  });
@@ -1562,7 +1605,7 @@ export class Call extends Eventing {
1562
1605
  this.emit(CALL_EVENT_KEYS.TRANSFER_ERROR, error);
1563
1606
  this.submitCallErrorMetric(error, TRANSFER_ACTION.CONSULT);
1564
1607
  }, ERROR_LAYER.CALL_CONTROL, (interval) => undefined, this.getCorrelationId(), errData, this.completeTransfer.name, CALL_FILE);
1565
- uploadLogs({
1608
+ await uploadLogs({
1566
1609
  correlationId: this.correlationId,
1567
1610
  callId: this.callId,
1568
1611
  });
@@ -1583,7 +1626,7 @@ export class Call extends Eventing {
1583
1626
  catch (err) {
1584
1627
  log.warn('Stats collection failed, using dummy stats', {
1585
1628
  file: CALL_FILE,
1586
- method: this.getCallStats.name,
1629
+ method: METHODS.GET_CALL_STATS,
1587
1630
  });
1588
1631
  }
1589
1632
  return parseMediaQualityStatistics(stats);
@@ -1591,7 +1634,7 @@ export class Call extends Eventing {
1591
1634
  async postMedia(roapMessage) {
1592
1635
  log.log('Posting message to Webex Calling', {
1593
1636
  file: CALL_FILE,
1594
- method: this.postMedia.name,
1637
+ method: METHODS.POST_MEDIA,
1595
1638
  });
1596
1639
  return this.webex.request({
1597
1640
  uri: `${this.mobiusUrl}${DEVICES_ENDPOINT_RESOURCE}/${this.deviceId}/${CALLS_ENDPOINT_RESOURCE}/${this.callId}/${MEDIA_ENDPOINT_RESOURCE}`,
@@ -1617,10 +1660,10 @@ export class Call extends Eventing {
1617
1660
  mediaRoapEventsListener() {
1618
1661
  this.mediaConnection.on(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, async (event) => {
1619
1662
  log.info(`ROAP message to send (rcv from MEDIA-SDK) :
1620
- \n type: ${event.roapMessage?.messageType}, seq: ${event.roapMessage.seq} , version: ${event.roapMessage.version}`, {});
1663
+ \n type: ${event.roapMessage?.messageType}, seq: ${event.roapMessage.seq} , version: ${event.roapMessage.version}`, { file: CALL_FILE, method: METHODS.MEDIA_ROAP_EVENTS_LISTENER });
1621
1664
  log.info(`SDP message to send : \n ${event.roapMessage?.sdp}`, {
1622
1665
  file: CALL_FILE,
1623
- method: this.mediaRoapEventsListener.name,
1666
+ method: METHODS.MEDIA_ROAP_EVENTS_LISTENER,
1624
1667
  });
1625
1668
  switch (event.roapMessage.messageType) {
1626
1669
  case RoapScenario.OK: {
@@ -1748,7 +1791,7 @@ export class Call extends Eventing {
1748
1791
  case MidCallEventType.CALL_INFO: {
1749
1792
  log.log(`Received Midcall CallInfo Event for correlationId : ${this.correlationId}`, {
1750
1793
  file: CALL_FILE,
1751
- method: 'handleMidCallEvent',
1794
+ method: METHODS.HANDLE_MID_CALL_EVENT,
1752
1795
  });
1753
1796
  const callerData = eventData;
1754
1797
  this.startCallerIdResolution(callerData.callerId);
@@ -1757,14 +1800,14 @@ export class Call extends Eventing {
1757
1800
  case MidCallEventType.CALL_STATE: {
1758
1801
  log.log(`Received Midcall call event for correlationId : ${this.correlationId}`, {
1759
1802
  file: CALL_FILE,
1760
- method: 'handleMidCallEvent',
1803
+ method: METHODS.HANDLE_MID_CALL_EVENT,
1761
1804
  });
1762
1805
  const data = eventData;
1763
1806
  switch (data.callState) {
1764
1807
  case MOBIUS_MIDCALL_STATE.HELD: {
1765
1808
  log.log(`Call is successfully held : ${this.correlationId}`, {
1766
1809
  file: CALL_FILE,
1767
- method: 'handleMidCallEvent',
1810
+ method: METHODS.HANDLE_MID_CALL_EVENT,
1768
1811
  });
1769
1812
  this.emit(CALL_EVENT_KEYS.HELD, this.correlationId);
1770
1813
  this.held = true;
@@ -1777,7 +1820,7 @@ export class Call extends Eventing {
1777
1820
  case MOBIUS_MIDCALL_STATE.CONNECTED: {
1778
1821
  log.log(`Call is successfully resumed : ${this.correlationId}`, {
1779
1822
  file: CALL_FILE,
1780
- method: 'handleMidCallEvent',
1823
+ method: METHODS.HANDLE_MID_CALL_EVENT,
1781
1824
  });
1782
1825
  this.emit(CALL_EVENT_KEYS.RESUMED, this.correlationId);
1783
1826
  this.held = false;
@@ -1790,7 +1833,7 @@ export class Call extends Eventing {
1790
1833
  default: {
1791
1834
  log.warn(`Unknown Supplementary service state: ${data.callState} for correlationId : ${this.correlationId}`, {
1792
1835
  file: CALL_FILE,
1793
- method: 'handleMidCallEvent',
1836
+ method: METHODS.HANDLE_MID_CALL_EVENT,
1794
1837
  });
1795
1838
  }
1796
1839
  }
@@ -1799,13 +1842,17 @@ export class Call extends Eventing {
1799
1842
  default: {
1800
1843
  log.warn(`Unknown Midcall type: ${eventType} for correlationId : ${this.correlationId}`, {
1801
1844
  file: CALL_FILE,
1802
- method: 'handleMidCallEvent',
1845
+ method: METHODS.HANDLE_MID_CALL_EVENT,
1803
1846
  });
1804
1847
  }
1805
1848
  }
1806
1849
  }
1807
1850
  getCallerInfo = () => this.callerInfo;
1808
1851
  end = () => {
1852
+ log.info(`${METHOD_START_MESSAGE}`, {
1853
+ file: CALL_FILE,
1854
+ method: METHODS.END,
1855
+ });
1809
1856
  this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_DISCONNECT' });
1810
1857
  };
1811
1858
  doHoldResume = () => {
@@ -1820,25 +1867,29 @@ export class Call extends Eventing {
1820
1867
  this.callerInfo = this.callerId.fetchCallerDetails(callerInfo);
1821
1868
  }
1822
1869
  sendDigit(tone) {
1870
+ log.info(`${METHOD_START_MESSAGE} with: ${tone}`, {
1871
+ file: CALL_FILE,
1872
+ method: METHODS.SEND_DIGIT,
1873
+ });
1823
1874
  try {
1824
- log.info(`Sending digit : ${tone}`, {
1825
- file: CALL_FILE,
1826
- method: 'sendDigit',
1827
- });
1828
1875
  this.mediaConnection.insertDTMF(tone);
1829
1876
  }
1830
1877
  catch (e) {
1831
1878
  log.warn(`Unable to send digit on call: ${e.message}`, {
1832
1879
  file: CALL_FILE,
1833
- method: 'sendDigit',
1880
+ method: METHODS.SEND_DIGIT,
1834
1881
  });
1835
1882
  }
1836
1883
  }
1837
1884
  mute = (localAudioStream, muteType) => {
1885
+ log.info(`${METHOD_START_MESSAGE} with: ${muteType || 'user mute'}`, {
1886
+ file: CALL_FILE,
1887
+ method: METHODS.MUTE,
1888
+ });
1838
1889
  if (!localAudioStream) {
1839
1890
  log.warn(`Did not find a local stream while muting the call ${this.getCorrelationId()}.`, {
1840
1891
  file: CALL_FILE,
1841
- method: 'mute',
1892
+ method: METHODS.MUTE,
1842
1893
  });
1843
1894
  return;
1844
1895
  }
@@ -1849,7 +1900,7 @@ export class Call extends Eventing {
1849
1900
  else {
1850
1901
  log.info(`Call is muted by the user already - ${this.getCorrelationId()}.`, {
1851
1902
  file: CALL_FILE,
1852
- method: 'mute',
1903
+ method: METHODS.MUTE,
1853
1904
  });
1854
1905
  }
1855
1906
  }
@@ -1860,7 +1911,7 @@ export class Call extends Eventing {
1860
1911
  else {
1861
1912
  log.info(`Call is muted on the system - ${this.getCorrelationId()}.`, {
1862
1913
  file: CALL_FILE,
1863
- method: 'mute',
1914
+ method: METHODS.MUTE,
1864
1915
  });
1865
1916
  }
1866
1917
  };
@@ -1869,7 +1920,7 @@ export class Call extends Eventing {
1869
1920
  if (!localAudioTrack) {
1870
1921
  log.warn(`Did not find a local track while updating media for call ${this.getCorrelationId()}. Will not update media`, {
1871
1922
  file: CALL_FILE,
1872
- method: 'updateMedia',
1923
+ method: METHODS.UPDATE_MEDIA,
1873
1924
  });
1874
1925
  return;
1875
1926
  }
@@ -1884,7 +1935,7 @@ export class Call extends Eventing {
1884
1935
  catch (e) {
1885
1936
  log.warn(`Unable to update media on call ${this.getCorrelationId()}. Error: ${e.message}`, {
1886
1937
  file: CALL_FILE,
1887
- method: 'updateMedia',
1938
+ method: METHODS.UPDATE_MEDIA,
1888
1939
  });
1889
1940
  }
1890
1941
  };
@@ -1900,14 +1951,14 @@ export class Call extends Eventing {
1900
1951
  async handleTimeout() {
1901
1952
  log.warn(`Call timed out`, {
1902
1953
  file: CALL_FILE,
1903
- method: 'handleTimeout',
1954
+ method: METHODS.HANDLE_TIMEOUT,
1904
1955
  });
1905
1956
  this.deleteCb(this.getCorrelationId());
1906
1957
  this.emit(CALL_EVENT_KEYS.DISCONNECT, this.getCorrelationId());
1907
1958
  const response = await this.delete();
1908
- log.log(`handleTimeout: Response code: ${response.statusCode}`, {
1959
+ log.log(`Response code: ${response.statusCode}`, {
1909
1960
  file: CALL_FILE,
1910
- method: this.handleTimeout.name,
1961
+ method: METHODS.HANDLE_TIMEOUT,
1911
1962
  });
1912
1963
  }
1913
1964
  }