@webex/calling 3.0.0-next.3 → 3.0.0-next.31

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 (217) hide show
  1. package/dist/CallHistory/CallHistory.js +6 -9
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  4. package/dist/CallHistory/callHistoryFixtures.js +12 -6
  5. package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
  6. package/dist/CallHistory/constants.js +9 -18
  7. package/dist/CallHistory/constants.js.map +1 -1
  8. package/dist/CallHistory/types.js.map +1 -1
  9. package/dist/CallSettings/CallSettings.js +18 -15
  10. package/dist/CallSettings/CallSettings.js.map +1 -1
  11. package/dist/CallSettings/CallSettings.test.js.map +1 -1
  12. package/dist/CallSettings/UcmBackendConnector.js +3 -4
  13. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  14. package/dist/CallSettings/UcmBackendConnector.test.js +2 -2
  15. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  16. package/dist/CallSettings/WxCallBackendConnector.js +19 -13
  17. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  18. package/dist/CallSettings/WxCallBackendConnector.test.js +2 -2
  19. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  20. package/dist/CallSettings/constants.js +11 -22
  21. package/dist/CallSettings/constants.js.map +1 -1
  22. package/dist/CallSettings/testFixtures.js +4 -8
  23. package/dist/CallSettings/testFixtures.js.map +1 -1
  24. package/dist/CallSettings/types.js.map +1 -1
  25. package/dist/CallingClient/CallingClient.js +135 -76
  26. package/dist/CallingClient/CallingClient.js.map +1 -1
  27. package/dist/CallingClient/CallingClient.test.js +170 -109
  28. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  29. package/dist/CallingClient/callRecordFixtures.js +2 -4
  30. package/dist/CallingClient/callRecordFixtures.js.map +1 -1
  31. package/dist/CallingClient/calling/CallerId/index.js +9 -29
  32. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  33. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  34. package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
  35. package/dist/CallingClient/calling/call.js +127 -71
  36. package/dist/CallingClient/calling/call.js.map +1 -1
  37. package/dist/CallingClient/calling/call.test.js +490 -357
  38. package/dist/CallingClient/calling/call.test.js.map +1 -1
  39. package/dist/CallingClient/calling/callManager.js +3 -14
  40. package/dist/CallingClient/calling/callManager.js.map +1 -1
  41. package/dist/CallingClient/calling/callManager.test.js +1 -1
  42. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  43. package/dist/CallingClient/calling/types.js +31 -33
  44. package/dist/CallingClient/calling/types.js.map +1 -1
  45. package/dist/CallingClient/callingClientFixtures.js +107 -17
  46. package/dist/CallingClient/callingClientFixtures.js.map +1 -1
  47. package/dist/CallingClient/constants.js +101 -193
  48. package/dist/CallingClient/constants.js.map +1 -1
  49. package/dist/CallingClient/line/index.js +20 -18
  50. package/dist/CallingClient/line/index.js.map +1 -1
  51. package/dist/CallingClient/line/line.test.js +13 -13
  52. package/dist/CallingClient/line/line.test.js.map +1 -1
  53. package/dist/CallingClient/line/types.js +7 -11
  54. package/dist/CallingClient/line/types.js.map +1 -1
  55. package/dist/CallingClient/registration/register.js +102 -111
  56. package/dist/CallingClient/registration/register.js.map +1 -1
  57. package/dist/CallingClient/registration/register.test.js +33 -32
  58. package/dist/CallingClient/registration/register.test.js.map +1 -1
  59. package/dist/CallingClient/registration/registerFixtures.js +5 -10
  60. package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
  61. package/dist/CallingClient/registration/types.js.map +1 -1
  62. package/dist/CallingClient/types.js.map +1 -1
  63. package/dist/Contacts/ContactsClient.js +38 -21
  64. package/dist/Contacts/ContactsClient.js.map +1 -1
  65. package/dist/Contacts/ContactsClient.test.js +4 -4
  66. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  67. package/dist/Contacts/constants.js +10 -18
  68. package/dist/Contacts/constants.js.map +1 -1
  69. package/dist/Contacts/contactFixtures.js +26 -52
  70. package/dist/Contacts/contactFixtures.js.map +1 -1
  71. package/dist/Contacts/types.js +31 -8
  72. package/dist/Contacts/types.js.map +1 -1
  73. package/dist/Errors/catalog/CallError.js +3 -5
  74. package/dist/Errors/catalog/CallError.js.map +1 -1
  75. package/dist/Errors/catalog/CallingDeviceError.js +4 -6
  76. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  77. package/dist/Errors/catalog/ExtendedError.js +2 -3
  78. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  79. package/dist/Errors/catalog/LineError.js +5 -7
  80. package/dist/Errors/catalog/LineError.js.map +1 -1
  81. package/dist/Errors/index.js +7 -0
  82. package/dist/Errors/index.js.map +1 -1
  83. package/dist/Errors/types.js +15 -20
  84. package/dist/Errors/types.js.map +1 -1
  85. package/dist/Events/impl/index.js +2 -3
  86. package/dist/Events/impl/index.js.map +1 -1
  87. package/dist/Events/types.js +43 -52
  88. package/dist/Events/types.js.map +1 -1
  89. package/dist/Logger/index.js +1 -2
  90. package/dist/Logger/index.js.map +1 -1
  91. package/dist/Logger/index.test.js.map +1 -1
  92. package/dist/Logger/types.js +9 -12
  93. package/dist/Logger/types.js.map +1 -1
  94. package/dist/Metrics/index.js +2 -4
  95. package/dist/Metrics/index.js.map +1 -1
  96. package/dist/Metrics/index.test.js +3 -3
  97. package/dist/Metrics/index.test.js.map +1 -1
  98. package/dist/Metrics/types.js +15 -20
  99. package/dist/Metrics/types.js.map +1 -1
  100. package/dist/SDKConnector/index.js +1 -2
  101. package/dist/SDKConnector/index.js.map +1 -1
  102. package/dist/SDKConnector/types.js.map +1 -1
  103. package/dist/SDKConnector/utils.js +1 -2
  104. package/dist/SDKConnector/utils.js.map +1 -1
  105. package/dist/Voicemail/BroadworksBackendConnector.js +21 -12
  106. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  107. package/dist/Voicemail/BroadworksBackendConnector.test.js +2 -2
  108. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  109. package/dist/Voicemail/UcmBackendConnector.js +19 -11
  110. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  111. package/dist/Voicemail/UcmBackendConnector.test.js +5 -4
  112. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  113. package/dist/Voicemail/Voicemail.js +35 -33
  114. package/dist/Voicemail/Voicemail.js.map +1 -1
  115. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  116. package/dist/Voicemail/WxCallBackendConnector.js +18 -11
  117. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  118. package/dist/Voicemail/WxCallBackendConnector.test.js +4 -4
  119. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  120. package/dist/Voicemail/constants.js +29 -58
  121. package/dist/Voicemail/constants.js.map +1 -1
  122. package/dist/Voicemail/types.js.map +1 -1
  123. package/dist/Voicemail/voicemailFixture.js +35 -70
  124. package/dist/Voicemail/voicemailFixture.js.map +1 -1
  125. package/dist/api.js +43 -20
  126. package/dist/api.js.map +1 -1
  127. package/dist/common/Utils.js +18 -25
  128. package/dist/common/Utils.js.map +1 -1
  129. package/dist/common/Utils.test.js +3 -3
  130. package/dist/common/Utils.test.js.map +1 -1
  131. package/dist/common/constants.js +41 -82
  132. package/dist/common/constants.js.map +1 -1
  133. package/dist/common/testUtil.js +12 -21
  134. package/dist/common/testUtil.js.map +1 -1
  135. package/dist/common/types.js +34 -43
  136. package/dist/common/types.js.map +1 -1
  137. package/dist/index.js +246 -0
  138. package/dist/index.js.map +1 -1
  139. package/dist/module/CallHistory/callHistoryFixtures.js +9 -0
  140. package/dist/module/CallingClient/CallingClient.js +59 -42
  141. package/dist/module/CallingClient/calling/CallerId/index.js +3 -23
  142. package/dist/module/CallingClient/calling/call.js +54 -17
  143. package/dist/module/CallingClient/calling/callManager.js +0 -6
  144. package/dist/module/CallingClient/callingClientFixtures.js +119 -1
  145. package/dist/module/CallingClient/constants.js +8 -4
  146. package/dist/module/CallingClient/line/index.js +9 -12
  147. package/dist/module/CallingClient/line/types.js +0 -5
  148. package/dist/module/CallingClient/registration/register.js +28 -20
  149. package/dist/module/Contacts/ContactsClient.js +3 -0
  150. package/dist/module/Errors/catalog/CallingDeviceError.js +2 -2
  151. package/dist/module/Errors/catalog/LineError.js +2 -2
  152. package/dist/module/Errors/index.js +1 -0
  153. package/dist/module/Events/types.js +1 -0
  154. package/dist/module/api.js +6 -5
  155. package/dist/module/common/Utils.js +14 -19
  156. package/dist/module/common/testUtil.js +2 -1
  157. package/dist/module/common/types.js +6 -5
  158. package/dist/module/index.js +9 -0
  159. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  160. package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
  161. package/dist/types/CallSettings/CallSettings.d.ts.map +1 -1
  162. package/dist/types/CallSettings/types.d.ts.map +1 -1
  163. package/dist/types/CallingClient/CallingClient.d.ts +2 -0
  164. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  165. package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
  166. package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -1
  167. package/dist/types/CallingClient/calling/call.d.ts +2 -0
  168. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  169. package/dist/types/CallingClient/calling/callManager.d.ts +0 -1
  170. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  171. package/dist/types/CallingClient/calling/types.d.ts +30 -30
  172. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  173. package/dist/types/CallingClient/callingClientFixtures.d.ts +69 -1
  174. package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -1
  175. package/dist/types/CallingClient/constants.d.ts +7 -3
  176. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  177. package/dist/types/CallingClient/line/index.d.ts +6 -6
  178. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  179. package/dist/types/CallingClient/line/types.d.ts +11 -23
  180. package/dist/types/CallingClient/line/types.d.ts.map +1 -1
  181. package/dist/types/CallingClient/registration/register.d.ts +3 -3
  182. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  183. package/dist/types/CallingClient/registration/types.d.ts +14 -14
  184. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  185. package/dist/types/CallingClient/types.d.ts +6 -4
  186. package/dist/types/CallingClient/types.d.ts.map +1 -1
  187. package/dist/types/Contacts/ContactsClient.d.ts +3 -2
  188. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  189. package/dist/types/Contacts/types.d.ts +2 -0
  190. package/dist/types/Contacts/types.d.ts.map +1 -1
  191. package/dist/types/Errors/catalog/CallingDeviceError.d.ts +4 -4
  192. package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -1
  193. package/dist/types/Errors/catalog/LineError.d.ts +4 -4
  194. package/dist/types/Errors/catalog/LineError.d.ts.map +1 -1
  195. package/dist/types/Errors/index.d.ts +1 -0
  196. package/dist/types/Errors/index.d.ts.map +1 -1
  197. package/dist/types/Errors/types.d.ts +2 -3
  198. package/dist/types/Errors/types.d.ts.map +1 -1
  199. package/dist/types/Events/types.d.ts +23 -1
  200. package/dist/types/Events/types.d.ts.map +1 -1
  201. package/dist/types/SDKConnector/types.d.ts +2 -1
  202. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  203. package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
  204. package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
  205. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
  206. package/dist/types/Voicemail/types.d.ts +10 -10
  207. package/dist/types/Voicemail/types.d.ts.map +1 -1
  208. package/dist/types/api.d.ts +10 -10
  209. package/dist/types/api.d.ts.map +1 -1
  210. package/dist/types/common/Utils.d.ts.map +1 -1
  211. package/dist/types/common/testUtil.d.ts +1 -0
  212. package/dist/types/common/testUtil.d.ts.map +1 -1
  213. package/dist/types/common/types.d.ts +3 -2
  214. package/dist/types/common/types.d.ts.map +1 -1
  215. package/dist/types/index.d.ts +13 -0
  216. package/dist/types/index.d.ts.map +1 -1
  217. package/package.json +5 -3
@@ -31,6 +31,7 @@ export class Call extends Eventing {
31
31
  mediaConnection;
32
32
  earlyMedia;
33
33
  connected;
34
+ mediaInactivity;
34
35
  callerInfo;
35
36
  localRoapMessage;
36
37
  mobiusUrl;
@@ -72,6 +73,7 @@ export class Call extends Eventing {
72
73
  this.correlationId = uuid();
73
74
  this.deleteCb = deleteCb;
74
75
  this.connected = false;
76
+ this.mediaInactivity = false;
75
77
  this.held = false;
76
78
  this.earlyMedia = false;
77
79
  this.callerInfo = {};
@@ -79,7 +81,7 @@ export class Call extends Eventing {
79
81
  this.mobiusUrl = activeUrl;
80
82
  this.receivedRoapOKSeq = 0;
81
83
  this.mediaNegotiationCompleted = false;
82
- log.info(`Mobius Url:- ${this.mobiusUrl}`, {
84
+ log.info(`Webex Calling Url:- ${this.mobiusUrl}`, {
83
85
  file: CALL_FILE,
84
86
  method: 'constructor',
85
87
  });
@@ -577,7 +579,7 @@ export class Call extends Eventing {
577
579
  this.setCallId(response.body.callId);
578
580
  }
579
581
  catch (e) {
580
- log.warn('Call setup failed with Mobius', {
582
+ log.warn('Failed to setup the call', {
581
583
  file: CALL_FILE,
582
584
  method: this.handleOutgoingCallSetup.name,
583
585
  });
@@ -614,7 +616,7 @@ export class Call extends Eventing {
614
616
  }
615
617
  }
616
618
  catch (e) {
617
- log.warn('Call Hold failed with Mobius', {
619
+ log.warn('Failed to put the call on hold', {
618
620
  file: CALL_FILE,
619
621
  method: this.handleCallHold.name,
620
622
  });
@@ -651,7 +653,7 @@ export class Call extends Eventing {
651
653
  }
652
654
  }
653
655
  catch (e) {
654
- log.warn('Call Resume failed with Mobius', {
656
+ log.warn('Failed to resume the call', {
655
657
  file: CALL_FILE,
656
658
  method: this.handleCallResume.name,
657
659
  });
@@ -735,7 +737,7 @@ export class Call extends Eventing {
735
737
  });
736
738
  }
737
739
  catch (err) {
738
- log.warn('Call Progress failed with Mobius', {
740
+ log.warn('Failed to signal call progression', {
739
741
  file: CALL_FILE,
740
742
  method: this.handleOutgoingCallAlerting.name,
741
743
  });
@@ -771,15 +773,15 @@ export class Call extends Eventing {
771
773
  return;
772
774
  }
773
775
  try {
776
+ this.mediaConnection.roapMessageReceived(this.remoteRoapMessage);
774
777
  const res = await this.patch(MobiusCallState.CONNECTED);
775
778
  log.log(`PATCH response: ${res.statusCode}`, {
776
779
  file: CALL_FILE,
777
780
  method: this.handleOutgoingCallConnect.name,
778
781
  });
779
- this.mediaConnection.roapMessageReceived(this.remoteRoapMessage);
780
782
  }
781
783
  catch (err) {
782
- log.warn('Call Connect failed with Mobius', {
784
+ log.warn('Failed to connect the call', {
783
785
  file: CALL_FILE,
784
786
  method: this.handleOutgoingCallConnect.name,
785
787
  });
@@ -805,7 +807,7 @@ export class Call extends Eventing {
805
807
  });
806
808
  }
807
809
  catch (e) {
808
- log.warn('Delete Call failed with Mobius', {
810
+ log.warn('Failed to delete the call', {
809
811
  file: CALL_FILE,
810
812
  method: this.handleIncomingCallDisconnect.name,
811
813
  });
@@ -832,7 +834,7 @@ export class Call extends Eventing {
832
834
  });
833
835
  }
834
836
  catch (e) {
835
- log.warn('Delete Call failed with Mobius', {
837
+ log.warn('Failed to delete the call', {
836
838
  file: CALL_FILE,
837
839
  method: this.handleOutgoingCallDisconnect.name,
838
840
  });
@@ -909,7 +911,7 @@ export class Call extends Eventing {
909
911
  });
910
912
  }
911
913
  catch (e) {
912
- log.warn('Delete Call failed with Mobius', {
914
+ log.warn('Failed to delete the call', {
913
915
  file: CALL_FILE,
914
916
  method: this.handleUnknownState.name,
915
917
  });
@@ -985,7 +987,7 @@ export class Call extends Eventing {
985
987
  }
986
988
  }
987
989
  catch (err) {
988
- log.warn('MediaOk failed with Mobius', {
990
+ log.warn('Failed to process MediaOk request', {
989
991
  file: CALL_FILE,
990
992
  method: 'handleRoapEstablished',
991
993
  });
@@ -1039,7 +1041,7 @@ export class Call extends Eventing {
1039
1041
  });
1040
1042
  }
1041
1043
  catch (err) {
1042
- log.warn('Failed to communicate ROAP error with Mobius', {
1044
+ log.warn('Failed to communicate ROAP error to Webex Calling', {
1043
1045
  file: CALL_FILE,
1044
1046
  method: this.handleRoapError.name,
1045
1047
  });
@@ -1080,7 +1082,7 @@ export class Call extends Eventing {
1080
1082
  });
1081
1083
  }
1082
1084
  catch (err) {
1083
- log.warn('MediaOk failed with Mobius', {
1085
+ log.warn('Failed to process MediaOk request', {
1084
1086
  file: CALL_FILE,
1085
1087
  method: this.handleOutgoingRoapOffer.name,
1086
1088
  });
@@ -1109,7 +1111,7 @@ export class Call extends Eventing {
1109
1111
  });
1110
1112
  }
1111
1113
  catch (err) {
1112
- log.warn('MediaAnswer failed with Mobius', {
1114
+ log.warn('Failed to send MediaAnswer request', {
1113
1115
  file: CALL_FILE,
1114
1116
  method: this.handleOutgoingRoapAnswer.name,
1115
1117
  });
@@ -1206,7 +1208,11 @@ export class Call extends Eventing {
1206
1208
  });
1207
1209
  };
1208
1210
  setDisconnectReason() {
1209
- if (this.connected || this.direction === CallDirection.OUTBOUND) {
1211
+ if (this.mediaInactivity) {
1212
+ this.disconnectReason.code = DisconnectCode.MEDIA_INACTIVITY;
1213
+ this.disconnectReason.cause = DisconnectCause.MEDIA_INACTIVITY;
1214
+ }
1215
+ else if (this.connected || this.direction === CallDirection.OUTBOUND) {
1210
1216
  this.disconnectReason.code = DisconnectCode.NORMAL;
1211
1217
  this.disconnectReason.cause = DisconnectCause.NORMAL;
1212
1218
  }
@@ -1220,6 +1226,15 @@ export class Call extends Eventing {
1220
1226
  };
1221
1227
  async answer(localAudioStream) {
1222
1228
  const localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
1229
+ if (!localAudioTrack) {
1230
+ log.warn(`Did not find a local track while answering the call ${this.getCorrelationId()}`, {
1231
+ file: CALL_FILE,
1232
+ method: 'answer',
1233
+ });
1234
+ this.mediaInactivity = true;
1235
+ this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_DISCONNECT' });
1236
+ return;
1237
+ }
1223
1238
  localAudioTrack.enabled = true;
1224
1239
  if (!this.mediaConnection) {
1225
1240
  this.initMediaConnection(localAudioTrack);
@@ -1236,6 +1251,15 @@ export class Call extends Eventing {
1236
1251
  }
1237
1252
  async dial(localAudioStream) {
1238
1253
  const localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
1254
+ if (!localAudioTrack) {
1255
+ log.warn(`Did not find a local track while dialing the call ${this.getCorrelationId()}`, {
1256
+ file: CALL_FILE,
1257
+ method: 'dial',
1258
+ });
1259
+ this.deleteCb(this.getCorrelationId());
1260
+ this.emit(CALL_EVENT_KEYS.DISCONNECT, this.getCorrelationId());
1261
+ return;
1262
+ }
1239
1263
  localAudioTrack.enabled = true;
1240
1264
  if (!this.mediaConnection) {
1241
1265
  this.initMediaConnection(localAudioTrack);
@@ -1276,7 +1300,7 @@ export class Call extends Eventing {
1276
1300
  });
1277
1301
  };
1278
1302
  async patch(state) {
1279
- log.info(`Send a PATCH for ${state} to mobius`, {
1303
+ log.info(`Send a PATCH for ${state} to Webex Calling`, {
1280
1304
  file: CALL_FILE,
1281
1305
  method: this.patch.name,
1282
1306
  });
@@ -1437,7 +1461,7 @@ export class Call extends Eventing {
1437
1461
  return parseMediaQualityStatistics(stats);
1438
1462
  }
1439
1463
  async postMedia(roapMessage) {
1440
- log.log('Posting message to mobius', {
1464
+ log.log('Posting message to Webex Calling', {
1441
1465
  file: CALL_FILE,
1442
1466
  method: this.postMedia.name,
1443
1467
  });
@@ -1645,6 +1669,19 @@ export class Call extends Eventing {
1645
1669
  this.muted = true;
1646
1670
  }
1647
1671
  };
1672
+ updateMedia = (newAudioStream) => {
1673
+ const localAudioTrack = newAudioStream.outputStream.getAudioTracks()[0];
1674
+ if (!localAudioTrack) {
1675
+ log.warn(`Did not find a local track while updating media for call ${this.getCorrelationId()}. Will not update media`, {
1676
+ file: CALL_FILE,
1677
+ method: 'updateMedia',
1678
+ });
1679
+ return;
1680
+ }
1681
+ this.mediaConnection.updateLocalTracks({
1682
+ audio: localAudioTrack,
1683
+ });
1684
+ };
1648
1685
  setBroadworksCorrelationInfo(broadworksCorrelationInfo) {
1649
1686
  this.broadworksCorrelationInfo = broadworksCorrelationInfo;
1650
1687
  }
@@ -257,12 +257,6 @@ export class CallManager extends Eventing {
257
257
  }
258
258
  }
259
259
  }
260
- endCall = (correlationId) => {
261
- const call = this.getCall(correlationId);
262
- if (call) {
263
- call.end();
264
- }
265
- };
266
260
  getCall = (correlationId) => {
267
261
  return this.callCollection[correlationId];
268
262
  };
@@ -35,4 +35,122 @@ const registrationPayload = {
35
35
  };
36
36
  const uri = `${webex.internal.services._serviceUrls.mobius}${URL_ENDPOINT}`;
37
37
  const myIP = mockIPReturnBody.ipv4;
38
- export { ipPayload, regionBody, regionPayload, primaryUrl, discoveryPayload, registrationPayload, uri, myIP, };
38
+ const mockUSServiceHosts = [
39
+ {
40
+ host: 'mobius-us-east-1.prod.infra.webex.com',
41
+ ttl: -1,
42
+ priority: 5,
43
+ id: 'urn:TEAM:us-east-2_a:mobius',
44
+ },
45
+ {
46
+ host: 'mobius-ca-central-1.prod.infra.webex.com',
47
+ ttl: -1,
48
+ priority: 10,
49
+ id: 'urn:TEAM:us-east-2_a:mobius',
50
+ },
51
+ {
52
+ host: 'mobius-eu-central-1.prod.infra.webex.com',
53
+ ttl: -1,
54
+ priority: 15,
55
+ id: 'urn:TEAM:us-east-2_a:mobius',
56
+ },
57
+ {
58
+ host: 'mobius-ap-southeast-2.prod.infra.webex.com',
59
+ ttl: -1,
60
+ priority: 20,
61
+ id: 'urn:TEAM:us-east-2_a:mobius',
62
+ },
63
+ ];
64
+ const mockEUServiceHosts = [
65
+ {
66
+ host: 'mobius-eu-central-1.prod.infra.webex.com',
67
+ ttl: -1,
68
+ priority: 5,
69
+ id: 'urn:TEAM:eu-central-1_k:mobius',
70
+ },
71
+ {
72
+ host: 'mobius-us-east-1.prod.infra.webex.com',
73
+ ttl: -1,
74
+ priority: 15,
75
+ id: 'urn:TEAM:eu-central-1_k:mobius',
76
+ },
77
+ {
78
+ host: 'mobius-ca-central-1.prod.infra.webex.com',
79
+ ttl: -1,
80
+ priority: 10,
81
+ id: 'urn:TEAM:eu-central-1_k:mobius',
82
+ },
83
+ {
84
+ host: 'mobius-ap-southeast-2.prod.infra.webex.com',
85
+ ttl: -1,
86
+ priority: 20,
87
+ id: 'urn:TEAM:eu-central-1_k:mobius',
88
+ },
89
+ ];
90
+ const mockEUIntServiceHosts = [
91
+ {
92
+ host: 'mobius-eu-central-1.int.infra.webex.com',
93
+ ttl: -1,
94
+ priority: 15,
95
+ id: 'urn:TEAM:us-east-2_a:mobius',
96
+ },
97
+ {
98
+ host: 'mobius-us-east-1.int.infra.webex.com',
99
+ ttl: -1,
100
+ priority: 5,
101
+ id: 'urn:TEAM:us-east-2_a:mobius',
102
+ },
103
+ {
104
+ host: 'mobius-ca-central-1.int.infra.webex.com',
105
+ ttl: -1,
106
+ priority: 10,
107
+ id: 'urn:TEAM:us-east-2_a:mobius',
108
+ },
109
+ {
110
+ host: 'mobius-ap-southeast-2.int.infra.webex.com',
111
+ ttl: -1,
112
+ priority: 20,
113
+ id: 'urn:TEAM:us-east-2_a:mobius',
114
+ },
115
+ ];
116
+ const mockIntServiceHosts = [
117
+ {
118
+ host: 'mobius-us-east-1.int.infra.webex.com',
119
+ ttl: -1,
120
+ priority: 5,
121
+ id: 'urn:TEAM:us-east-2_a:mobius',
122
+ },
123
+ {
124
+ host: 'mobius-ca-central-1.int.infra.webex.com',
125
+ ttl: -1,
126
+ priority: 10,
127
+ id: 'urn:TEAM:us-east-2_a:mobius',
128
+ },
129
+ {
130
+ host: 'mobius-eu-central-1.int.infra.webex.com',
131
+ ttl: -1,
132
+ priority: 15,
133
+ id: 'urn:TEAM:us-east-2_a:mobius',
134
+ },
135
+ {
136
+ host: 'mobius-ap-southeast-2.int.infra.webex.com',
137
+ ttl: -1,
138
+ priority: 20,
139
+ id: 'urn:TEAM:us-east-2_a:mobius',
140
+ },
141
+ ];
142
+ const mockCatalogEU = {
143
+ 'mobius-eu-central-1.prod.infra.webex.com': mockEUServiceHosts,
144
+ };
145
+ const mockCatalogEUInt = {
146
+ 'mobius-eu-central-1.int.infra.webex.com': mockEUIntServiceHosts,
147
+ };
148
+ const mockCatalogUS = {
149
+ 'mobius-us-east-1.prod.infra.webex.com': mockUSServiceHosts,
150
+ 'mobius-eu-central-1.prod.infra.webex.com': mockEUServiceHosts,
151
+ };
152
+ const mockCatalogUSInt = {
153
+ 'mobius-us-east-1.int.infra.webex.com': mockIntServiceHosts,
154
+ 'mobius-eu-central-1.int.infra.webex.com': mockEUIntServiceHosts,
155
+ };
156
+ export { ipPayload, regionBody, regionPayload, primaryUrl, discoveryPayload, registrationPayload, uri, myIP, mockEUServiceHosts, mockEUIntServiceHosts, mockIntServiceHosts, mockUSServiceHosts, mockCatalogEU, mockCatalogEUInt, mockCatalogUS, mockCatalogUSInt, };
@@ -1,7 +1,6 @@
1
- export const VERSION = '1.71.1';
2
- export const REPO_NAME = 'web-calling-sdk';
3
- export const CALLING_FEATURE = 'web-calling';
4
- export const CALLING_USER_AGENT = `${REPO_NAME}/${VERSION} (${CALLING_FEATURE})`;
1
+ export const VERSION = 'beta';
2
+ export const REPO_NAME = 'webex-calling';
3
+ export const CALLING_USER_AGENT = `${REPO_NAME}/${VERSION}`;
5
4
  export const CALL_ENDPOINT_RESOURCE = 'call';
6
5
  export const CALL_STATUS_RESOURCE = 'status';
7
6
  export const CALLS_ENDPOINT_RESOURCE = 'calls';
@@ -59,6 +58,7 @@ export const SCIM_USER_FILTER = 'v1/Users?filter=';
59
58
  export const SPARK_USER_AGENT = 'spark-user-agent';
60
59
  export const REGISTER_RETRY_TIMEOUT = 10000;
61
60
  export const SUPPLEMENTARY_SERVICES_TIMEOUT = 10000;
61
+ export const API_V1 = '/api/v1';
62
62
  export const URL_ENDPOINT = '/calling/web/';
63
63
  export const VALID_PHONE = /[\d\s()*#+.-]+/;
64
64
  export const WEB_AGENT = '(web)';
@@ -120,3 +120,7 @@ export const FAILOVER_UTIL = 'startFailoverTimer';
120
120
  export const NETWORK_CHANGE_DETECTION_UTIL = 'detectNetworkChange';
121
121
  export const CALLS_CLEARED_HANDLER_UTIL = 'callsClearedHandler';
122
122
  export const RECONNECT_UTIL = 'reconnectOnFailure';
123
+ export const MOBIUS_US_PROD = 'mobius-us-east-1.prod.infra.webex.com';
124
+ export const MOBIUS_EU_PROD = 'mobius-eu-central-1.prod.infra.webex.com';
125
+ export const MOBIUS_US_INT = 'mobius-us-east-1.int.infra.webex.com';
126
+ export const MOBIUS_EU_INT = 'mobius-eu-central-1.int.infra.webex.com';
@@ -1,6 +1,6 @@
1
1
  import { v4 as uuid } from 'uuid';
2
- import { CallDirection, MobiusStatus, ServiceIndicator, } from '../../common/types';
3
- import { LINE_EVENTS, LineStatus } from './types';
2
+ import { CallDirection, RegistrationStatus, ServiceIndicator, } from '../../common/types';
3
+ import { LINE_EVENTS } from './types';
4
4
  import { LINE_FILE, VALID_PHONE } from '../constants';
5
5
  import log from '../../Logger';
6
6
  import { createRegistration } from '../registration';
@@ -23,8 +23,7 @@ export default class Line extends Eventing {
23
23
  mobiusUri;
24
24
  phoneNumber;
25
25
  extension;
26
- status;
27
- sipAddresses;
26
+ sipAddresses = [];
28
27
  voicemail;
29
28
  lastSeen;
30
29
  keepaliveInterval;
@@ -36,12 +35,11 @@ export default class Line extends Eventing {
36
35
  callManager;
37
36
  #primaryMobiusUris;
38
37
  #backupMobiusUris;
39
- constructor(userId, clientDeviceUri, status, mutex, primaryMobiusUris, backupMobiusUris, logLevel, serviceDataConfig, phoneNumber, extension, voicemail) {
38
+ constructor(userId, clientDeviceUri, mutex, primaryMobiusUris, backupMobiusUris, logLevel, serviceDataConfig, phoneNumber, extension, voicemail) {
40
39
  super();
41
40
  this.lineId = uuid();
42
41
  this.userId = userId;
43
42
  this.clientDeviceUri = clientDeviceUri;
44
- this.status = status;
45
43
  this.phoneNumber = phoneNumber;
46
44
  this.extension = extension;
47
45
  this.voicemail = voicemail;
@@ -55,14 +53,12 @@ export default class Line extends Eventing {
55
53
  : { indicator: ServiceIndicator.CALLING, domain: '' };
56
54
  validateServiceData(serviceData);
57
55
  this.registration = createRegistration(this.#webex, serviceData, this.#mutex, this.lineEmitter, logLevel);
58
- this.registration.setStatus(MobiusStatus.DEFAULT);
59
56
  log.setLogger(logLevel, LINE_FILE);
60
57
  this.callManager = getCallManager(this.#webex, serviceData.indicator);
61
58
  this.incomingCallListener();
62
59
  }
63
60
  async register() {
64
61
  await this.#mutex.runExclusive(async () => {
65
- this.registration.setStatus(MobiusStatus.DEFAULT);
66
62
  this.emit(LINE_EVENTS.CONNECTING);
67
63
  this.registration.setMobiusServers(this.#primaryMobiusUris, this.#backupMobiusUris);
68
64
  await this.registration.triggerRegistration();
@@ -72,14 +68,15 @@ export default class Line extends Eventing {
72
68
  }
73
69
  }
74
70
  async deregister() {
75
- this.registration.deregister();
71
+ await this.registration.deregister();
72
+ this.registration.setStatus(RegistrationStatus.IDLE);
76
73
  }
77
74
  normalizeLine(deviceInfo) {
78
75
  const { device, keepaliveInterval, callKeepaliveInterval, rehomingIntervalMin, rehomingIntervalMax, voicePortalNumber, voicePortalExtension, } = deviceInfo;
79
76
  this.mobiusDeviceId = device?.deviceId;
80
77
  this.mobiusUri = device?.uri;
81
78
  this.lastSeen = device?.lastSeen;
82
- this.sipAddresses = device?.addresses;
79
+ this.sipAddresses = device?.addresses ?? [];
83
80
  this.keepaliveInterval = keepaliveInterval;
84
81
  this.callKeepaliveInterval = callKeepaliveInterval;
85
82
  this.rehomingIntervalMin = rehomingIntervalMin;
@@ -115,7 +112,7 @@ export default class Line extends Eventing {
115
112
  getActiveMobiusUrl() {
116
113
  return this.registration.getActiveMobiusUrl();
117
114
  }
118
- getRegistrationStatus = () => this.registration.getStatus();
115
+ getStatus = () => this.registration.getStatus();
119
116
  getDeviceId = () => this.registration.getDeviceInfo().device?.deviceId;
120
117
  makeCall = (dest) => {
121
118
  let call;
@@ -135,7 +132,7 @@ export default class Line extends Eventing {
135
132
  }
136
133
  else {
137
134
  log.warn('Invalid phone number detected', {});
138
- const err = new LineError('An invalid phone number was detected. Check the number and try again.', {}, ERROR_TYPE.CALL_ERROR, LineStatus.ACTIVE);
135
+ const err = new LineError('An invalid phone number was detected. Check the number and try again.', {}, ERROR_TYPE.CALL_ERROR, RegistrationStatus.ACTIVE);
139
136
  this.emit(LINE_EVENTS.ERROR, err);
140
137
  }
141
138
  return call;
@@ -1,8 +1,3 @@
1
- export var LineStatus;
2
- (function (LineStatus) {
3
- LineStatus["INACTIVE"] = "inactive";
4
- LineStatus["ACTIVE"] = "active";
5
- })(LineStatus || (LineStatus = {}));
6
1
  export var LINE_EVENTS;
7
2
  (function (LINE_EVENTS) {
8
3
  LINE_EVENTS["CONNECTING"] = "connecting";
@@ -6,7 +6,7 @@ import { getMetricManager } from '../../Metrics';
6
6
  import { getCallManager } from '../calling';
7
7
  import log from '../../Logger';
8
8
  import SDKConnector from '../../SDKConnector';
9
- import { ALLOWED_SERVICES, HTTP_METHODS, MobiusStatus, } from '../../common/types';
9
+ import { ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, } from '../../common/types';
10
10
  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, FAILBACK_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, } from '../constants';
11
11
  import { LINE_EVENTS } from '../line/types';
12
12
  export class Registration {
@@ -38,7 +38,7 @@ export class Registration {
38
38
  }
39
39
  this.webex = this.sdkConnector.getWebex();
40
40
  this.userId = this.webex.internal.device.userId;
41
- this.registrationStatus = MobiusStatus.DEFAULT;
41
+ this.registrationStatus = RegistrationStatus.IDLE;
42
42
  this.failback429RetryAttempts = 0;
43
43
  log.setLogger(logLevel, REGISTRATION_FILE);
44
44
  this.rehomingIntervalMin = DEFAULT_REHOMING_INTERVAL_MIN;
@@ -74,17 +74,24 @@ export class Registration {
74
74
  });
75
75
  }
76
76
  async deleteRegistration(url, deviceId, deviceUrl) {
77
- const response = await fetch(`${url}${DEVICES_ENDPOINT_RESOURCE}/${deviceId}`, {
78
- method: HTTP_METHODS.DELETE,
79
- headers: {
80
- [CISCO_DEVICE_URL]: deviceUrl,
81
- Authorization: await this.webex.credentials.getUserToken(),
82
- trackingId: `${WEBEX_WEB_CLIENT}_${uuid()}`,
83
- [SPARK_USER_AGENT]: CALLING_USER_AGENT,
84
- },
85
- });
77
+ let response;
78
+ try {
79
+ response = await fetch(`${url}${DEVICES_ENDPOINT_RESOURCE}/${deviceId}`, {
80
+ method: HTTP_METHODS.DELETE,
81
+ headers: {
82
+ [CISCO_DEVICE_URL]: deviceUrl,
83
+ Authorization: await this.webex.credentials.getUserToken(),
84
+ trackingId: `${WEBEX_WEB_CLIENT}_${uuid()}`,
85
+ [SPARK_USER_AGENT]: CALLING_USER_AGENT,
86
+ },
87
+ });
88
+ }
89
+ catch (error) {
90
+ log.warn(`Delete failed with Mobius`, {});
91
+ }
92
+ this.setStatus(RegistrationStatus.INACTIVE);
86
93
  this.lineEmitter(LINE_EVENTS.UNREGISTERED);
87
- return response.json();
94
+ return response?.json();
88
95
  }
89
96
  async postRegistration(url) {
90
97
  const deviceInfo = {
@@ -265,7 +272,7 @@ export class Registration {
265
272
  return this.deviceInfo;
266
273
  }
267
274
  isDeviceRegistered() {
268
- return this.registrationStatus === MobiusStatus.ACTIVE;
275
+ return this.registrationStatus === RegistrationStatus.ACTIVE;
269
276
  }
270
277
  getStatus() {
271
278
  return this.registrationStatus;
@@ -284,7 +291,7 @@ export class Registration {
284
291
  async handleConnectionRestoration(retry) {
285
292
  await this.mutex.runExclusive(async () => {
286
293
  if (retry) {
287
- log.info('Mercury connection is up again, Re-registering with Mobius', {
294
+ log.info('Mercury connection is up again, re-registering with Webex Calling if needed', {
288
295
  file: REGISTRATION_FILE,
289
296
  method: this.handleConnectionRestoration.name,
290
297
  });
@@ -347,7 +354,7 @@ export class Registration {
347
354
  for (const url of servers) {
348
355
  try {
349
356
  abort = false;
350
- this.registrationStatus = MobiusStatus.DEFAULT;
357
+ this.registrationStatus = RegistrationStatus.INACTIVE;
351
358
  this.lineEmitter(LINE_EVENTS.CONNECTING);
352
359
  log.log(`[${caller}] : Mobius url to contact: ${url}`, {
353
360
  file: REGISTRATION_FILE,
@@ -355,8 +362,8 @@ export class Registration {
355
362
  });
356
363
  const resp = await this.postRegistration(url);
357
364
  this.deviceInfo = resp.body;
365
+ this.registrationStatus = RegistrationStatus.ACTIVE;
358
366
  this.lineEmitter(LINE_EVENTS.REGISTERED, resp.body);
359
- this.registrationStatus = MobiusStatus.ACTIVE;
360
367
  this.setActiveMobiusUrl(url);
361
368
  this.setIntervalValues(this.deviceInfo);
362
369
  this.metricManager.setDeviceInfo(this.deviceInfo);
@@ -376,7 +383,7 @@ export class Registration {
376
383
  }
377
384
  this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, clientError);
378
385
  }, { method: this.attemptRegistrationWithServers.name, file: REGISTRATION_FILE }, this.restoreRegistrationCallBack());
379
- if (this.registrationStatus === MobiusStatus.ACTIVE) {
386
+ if (this.registrationStatus === RegistrationStatus.ACTIVE) {
380
387
  log.info(`[${caller}] : Device is already restored, active mobius url: ${this.activeMobiusUrl}`, {
381
388
  file: REGISTRATION_FILE,
382
389
  method: this.attemptRegistrationWithServers.name,
@@ -384,6 +391,7 @@ export class Registration {
384
391
  break;
385
392
  }
386
393
  if (abort) {
394
+ this.setStatus(RegistrationStatus.INACTIVE);
387
395
  break;
388
396
  }
389
397
  else if (caller === this.executeFailback.name) {
@@ -427,7 +435,7 @@ export class Registration {
427
435
  this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION, REG_ACTION.KEEPALIVE_FAILURE, METRIC_TYPE.BEHAVIORAL, clientError);
428
436
  }, { method: this.startKeepaliveTimer.name, file: REGISTRATION_FILE });
429
437
  if (abort || keepAliveRetryCount >= 5) {
430
- this.setStatus(MobiusStatus.DEFAULT);
438
+ this.setStatus(RegistrationStatus.INACTIVE);
431
439
  this.clearKeepaliveTimer();
432
440
  this.clearFailbackTimer();
433
441
  this.lineEmitter(LINE_EVENTS.UNREGISTERED);
@@ -460,7 +468,7 @@ export class Registration {
460
468
  log.warn(`Delete failed with Mobius`, {});
461
469
  }
462
470
  this.clearKeepaliveTimer();
463
- this.setStatus(MobiusStatus.DEFAULT);
471
+ this.setStatus(RegistrationStatus.INACTIVE);
464
472
  }
465
473
  isRegRetry() {
466
474
  return this.registerRetry;
@@ -480,7 +488,7 @@ export class Registration {
480
488
  const stringToReplace = `${DEVICES_ENDPOINT_RESOURCE}/${restoreData.devices[0].deviceId}`;
481
489
  const uri = restoreData.devices[0].uri.replace(stringToReplace, '');
482
490
  this.setActiveMobiusUrl(uri);
483
- this.registrationStatus = MobiusStatus.ACTIVE;
491
+ this.registrationStatus = RegistrationStatus.ACTIVE;
484
492
  return true;
485
493
  }
486
494
  return false;
@@ -480,5 +480,8 @@ export class ContactsClient {
480
480
  return errorStatus;
481
481
  }
482
482
  }
483
+ getSDKConnector() {
484
+ return this.sdkConnector;
485
+ }
483
486
  }
484
487
  export const createContactsClient = (webex, logger) => new ContactsClient(webex, logger);
@@ -1,7 +1,7 @@
1
- import { MobiusStatus } from '../../common/types';
1
+ import { RegistrationStatus } from '../../common/types';
2
2
  import ExtendedError from './ExtendedError';
3
3
  export class CallingClientError extends ExtendedError {
4
- status = MobiusStatus.DEFAULT;
4
+ status = RegistrationStatus.INACTIVE;
5
5
  constructor(msg, context, type, status) {
6
6
  super(msg, context, type);
7
7
  this.status = status;
@@ -1,7 +1,7 @@
1
- import { LineStatus } from '../../CallingClient/line/types';
1
+ import { RegistrationStatus } from '../../common/types';
2
2
  import ExtendedError from './ExtendedError';
3
3
  export class LineError extends ExtendedError {
4
- status = LineStatus.INACTIVE;
4
+ status = RegistrationStatus.INACTIVE;
5
5
  constructor(msg, context, type, status) {
6
6
  super(msg, context, type);
7
7
  this.status = status;
@@ -1,2 +1,3 @@
1
1
  export { CallingClientError } from './catalog/CallingDeviceError';
2
2
  export { CallError } from './catalog/CallError';
3
+ export { LineError } from './catalog/LineError';
@@ -1,3 +1,4 @@
1
+ import { LINE_EVENTS } from '../CallingClient/line/types';
1
2
  export var COMMON_EVENT_KEYS;
2
3
  (function (COMMON_EVENT_KEYS) {
3
4
  COMMON_EVENT_KEYS["CB_VOICEMESSAGE_CONTENT_GET"] = "call_back_voicemail_content_get";
@@ -1,6 +1,7 @@
1
- import { CallHistory } from './CallHistory/CallHistory';
2
- import { CallSettings } from './CallSettings/CallSettings';
3
- import { CallingClient } from './CallingClient/CallingClient';
4
- import { ContactsClient } from './Contacts/ContactsClient';
5
- import { Voicemail } from './Voicemail/Voicemail';
1
+ import { CallHistory, createCallHistoryClient } from './CallHistory/CallHistory';
2
+ import { CallSettings, createCallSettingsClient } from './CallSettings/CallSettings';
3
+ import { CallingClient, createClient } from './CallingClient/CallingClient';
4
+ import { ContactsClient, createContactsClient } from './Contacts/ContactsClient';
5
+ import { Voicemail, createVoicemailClient } from './Voicemail/Voicemail';
6
6
  export { CallHistory, CallSettings, CallingClient, ContactsClient, Voicemail };
7
+ export { createCallHistoryClient, createCallSettingsClient, createClient, createContactsClient, createVoicemailClient, };