@webex/calling 3.12.0-webex-services-ready.4 → 3.13.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.
Files changed (124) hide show
  1. package/dist/CallRecording/WxcCallRecordingConnector.js +345 -174
  2. package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -1
  3. package/dist/CallRecording/WxcCallRecordingConnector.test.js +354 -182
  4. package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -1
  5. package/dist/CallRecording/callRecordingFixtures.js +40 -9
  6. package/dist/CallRecording/callRecordingFixtures.js.map +1 -1
  7. package/dist/CallRecording/constants.js +12 -27
  8. package/dist/CallRecording/constants.js.map +1 -1
  9. package/dist/CallRecording/types.js +21 -16
  10. package/dist/CallRecording/types.js.map +1 -1
  11. package/dist/CallRecording/userhub.js +117 -0
  12. package/dist/CallRecording/userhub.js.map +1 -0
  13. package/dist/CallRecording/utils.js +3 -3
  14. package/dist/CallRecording/utils.js.map +1 -1
  15. package/dist/CallingClient/CallingClient.js +19 -13
  16. package/dist/CallingClient/CallingClient.js.map +1 -1
  17. package/dist/CallingClient/CallingClient.test.js +383 -185
  18. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  19. package/dist/CallingClient/calling/CallerId/index.js +3 -1
  20. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  21. package/dist/CallingClient/calling/CallerId/index.test.js +12 -2
  22. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  23. package/dist/CallingClient/calling/call.js +15 -8
  24. package/dist/CallingClient/calling/call.js.map +1 -1
  25. package/dist/CallingClient/calling/call.test.js +617 -527
  26. package/dist/CallingClient/calling/call.test.js.map +1 -1
  27. package/dist/CallingClient/constants.js +5 -2
  28. package/dist/CallingClient/constants.js.map +1 -1
  29. package/dist/CallingClient/line/index.js +23 -2
  30. package/dist/CallingClient/line/index.js.map +1 -1
  31. package/dist/CallingClient/line/line.test.js +87 -17
  32. package/dist/CallingClient/line/line.test.js.map +1 -1
  33. package/dist/CallingClient/registration/register.js +559 -411
  34. package/dist/CallingClient/registration/register.js.map +1 -1
  35. package/dist/CallingClient/registration/register.test.js +646 -83
  36. package/dist/CallingClient/registration/register.test.js.map +1 -1
  37. package/dist/CallingClient/registration/types.js +26 -0
  38. package/dist/CallingClient/registration/types.js.map +1 -1
  39. package/dist/CallingClient/types.js.map +1 -1
  40. package/dist/Errors/types.js +2 -0
  41. package/dist/Errors/types.js.map +1 -1
  42. package/dist/Events/types.js.map +1 -1
  43. package/dist/SDKConnector/types.js.map +1 -1
  44. package/dist/common/Utils.js +124 -105
  45. package/dist/common/Utils.js.map +1 -1
  46. package/dist/common/Utils.test.js +346 -243
  47. package/dist/common/Utils.test.js.map +1 -1
  48. package/dist/common/callUtils.js +187 -0
  49. package/dist/common/callUtils.js.map +1 -0
  50. package/dist/common/callUtils.test.js +313 -0
  51. package/dist/common/callUtils.test.js.map +1 -0
  52. package/dist/common/constants.js +27 -1
  53. package/dist/common/constants.js.map +1 -1
  54. package/dist/common/index.js +11 -0
  55. package/dist/common/index.js.map +1 -1
  56. package/dist/common/testUtil.js +2 -1
  57. package/dist/common/testUtil.js.map +1 -1
  58. package/dist/mobius-socket/mobius-socket-events.test.js +1 -0
  59. package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -1
  60. package/dist/mobius-socket/mobius-socket.test.js +12 -12
  61. package/dist/mobius-socket/mobius-socket.test.js.map +1 -1
  62. package/dist/mobius-socket/socket/socket-base.js +10 -0
  63. package/dist/mobius-socket/socket/socket-base.js.map +1 -1
  64. package/dist/mobius-socket/socket.test.js +34 -14
  65. package/dist/mobius-socket/socket.test.js.map +1 -1
  66. package/dist/module/CallRecording/WxcCallRecordingConnector.js +155 -63
  67. package/dist/module/CallRecording/callRecordingFixtures.js +38 -8
  68. package/dist/module/CallRecording/constants.js +11 -12
  69. package/dist/module/CallRecording/userhub.js +100 -0
  70. package/dist/module/CallingClient/CallingClient.js +12 -11
  71. package/dist/module/CallingClient/calling/CallerId/index.js +2 -2
  72. package/dist/module/CallingClient/calling/call.js +10 -3
  73. package/dist/module/CallingClient/constants.js +3 -0
  74. package/dist/module/CallingClient/line/index.js +9 -1
  75. package/dist/module/CallingClient/registration/register.js +69 -16
  76. package/dist/module/CallingClient/registration/types.js +5 -1
  77. package/dist/module/Errors/types.js +2 -0
  78. package/dist/module/common/Utils.js +43 -43
  79. package/dist/module/common/callUtils.js +90 -0
  80. package/dist/module/common/constants.js +11 -0
  81. package/dist/module/common/index.js +1 -0
  82. package/dist/module/common/testUtil.js +1 -0
  83. package/dist/module/mobius-socket/socket/socket-base.js +8 -0
  84. package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +6 -2
  85. package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -1
  86. package/dist/types/CallRecording/callRecordingFixtures.d.ts +95 -4
  87. package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -1
  88. package/dist/types/CallRecording/constants.d.ts +11 -12
  89. package/dist/types/CallRecording/constants.d.ts.map +1 -1
  90. package/dist/types/CallRecording/types.d.ts +11 -3
  91. package/dist/types/CallRecording/types.d.ts.map +1 -1
  92. package/dist/types/CallRecording/userhub.d.ts +44 -0
  93. package/dist/types/CallRecording/userhub.d.ts.map +1 -0
  94. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  95. package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
  96. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  97. package/dist/types/CallingClient/constants.d.ts +3 -0
  98. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  99. package/dist/types/CallingClient/line/index.d.ts +2 -1
  100. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  101. package/dist/types/CallingClient/registration/register.d.ts +3 -1
  102. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  103. package/dist/types/CallingClient/registration/types.d.ts +22 -0
  104. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  105. package/dist/types/CallingClient/types.d.ts +2 -0
  106. package/dist/types/CallingClient/types.d.ts.map +1 -1
  107. package/dist/types/Errors/types.d.ts +2 -0
  108. package/dist/types/Errors/types.d.ts.map +1 -1
  109. package/dist/types/Events/types.d.ts +1 -1
  110. package/dist/types/Events/types.d.ts.map +1 -1
  111. package/dist/types/SDKConnector/types.d.ts +1 -0
  112. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  113. package/dist/types/common/Utils.d.ts +4 -6
  114. package/dist/types/common/Utils.d.ts.map +1 -1
  115. package/dist/types/common/callUtils.d.ts +6 -0
  116. package/dist/types/common/callUtils.d.ts.map +1 -0
  117. package/dist/types/common/constants.d.ts +6 -0
  118. package/dist/types/common/constants.d.ts.map +1 -1
  119. package/dist/types/common/index.d.ts +1 -0
  120. package/dist/types/common/index.d.ts.map +1 -1
  121. package/dist/types/common/testUtil.d.ts +1 -0
  122. package/dist/types/common/testUtil.d.ts.map +1 -1
  123. package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -1
  124. package/package.json +12 -11
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.discoverHostIps = discoverHostIps;
9
+ exports.getHostIps = getHostIps;
10
+ exports.getHostIpsFromSdp = getHostIpsFromSdp;
11
+ exports.modifySdpForIPv4 = modifySdpForIPv4;
12
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
13
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
14
+ var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/parse-int"));
15
+ var _internalMediaCore = require("@webex/internal-media-core");
16
+ var _constants = require("../CallingClient/constants");
17
+ var _Logger = _interopRequireDefault(require("../Logger"));
18
+ var _constants2 = require("./constants");
19
+ var hostIps = [];
20
+
21
+ /**
22
+ * Modifies SDP to replace IPv6 "c=" lines with IPv4.And adds an IPv4 candidate if none exists.
23
+ *
24
+ * @param sdp - Session Description Protocol string.
25
+ * @returns Modified SDP string.
26
+ */
27
+ function modifySdpForIPv4(sdp) {
28
+ try {
29
+ // Normalize line endings to avoid issues
30
+ sdp = sdp.replace(/\r\n|\r/g, '\n');
31
+
32
+ // Ensure consistent spacing without removing intentional indentation
33
+ sdp = sdp.replace(/^[ \t]+/gm, '');
34
+
35
+ // Check if at least one IPv6 "c=" line is present
36
+ var ipv6CLineMatches = sdp.match(/c=IN IP6 [\da-f:.]+/gi) || [];
37
+ var hasIPv6CLine = ipv6CLineMatches.length > 0;
38
+ if (hasIPv6CLine) {
39
+ _Logger.default.info('Modifying SDP for IPv4 compatibility', {
40
+ file: _constants.CALL_UTILS_FILE,
41
+ method: 'modifySdpForIPv4'
42
+ });
43
+
44
+ // Extract an existing IPv4 candidate's IP, if available
45
+ var ipv4CandidateMatch = sdp.match(/a=candidate:\d+ \d+ \w+ \d+ ([\d.]+) \d+ typ \w+/);
46
+ var ipv4Address = (ipv4CandidateMatch === null || ipv4CandidateMatch === void 0 ? void 0 : ipv4CandidateMatch[1]) || _constants2.IPV4_FALLBACK_ADDRESS; // Default fallback
47
+
48
+ // Replace all IPv6 "c=" lines with IPv4 using the extracted IP (or default)
49
+ sdp = sdp.replace(/c=IN IP6 [\da-f:.]+/gi, "c=IN IP4 ".concat(ipv4Address));
50
+
51
+ // Ensure newline separation between candidate lines
52
+ if (!ipv4CandidateMatch) {
53
+ var ipv4CandidateAdded = false;
54
+ sdp = sdp.replace(/(a=candidate:(\d+) (\d+) (\w+) (\d+) ([\da-f:.]+) (\d+) typ (\w+)[^\n]*)/g, function (match, full, foundation, componentId, transport, priority, connectionAddress, port, candidateType) {
55
+ if (!ipv4CandidateAdded && connectionAddress.includes(':')) {
56
+ // Ensure it's IPv6 and only add once
57
+ ipv4CandidateAdded = true;
58
+ var newFoundation = ((0, _parseInt2.default)(foundation, 10) + 1).toString();
59
+ return "".concat(full, "\n") + "a=candidate:".concat(newFoundation, " ").concat(componentId, " ").concat(transport, " ").concat(priority, " ").concat(ipv4Address, " ").concat(port, " typ ").concat(candidateType, " generation 0 network-id 1 network-cost 10");
60
+ }
61
+ return match;
62
+ });
63
+ }
64
+ }
65
+ return sdp;
66
+ } catch (error) {
67
+ _Logger.default.warn("Error modifying SDP for IPv4 compatibility: ".concat(error), {
68
+ file: _constants.CALL_UTILS_FILE,
69
+ method: 'modifySdpForIPv4'
70
+ });
71
+ return sdp; // Return original SDP in case of an error
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Host ip addresses of this client, as stored by the last {@link discoverHostIps}. Empty until
77
+ * that discovery has resolved, and whenever it found or reported none.
78
+ */
79
+ function getHostIps() {
80
+ return hostIps;
81
+ }
82
+
83
+ /**
84
+ * Returns the host ip addresses advertised by the host candidates of an SDP, dropping the ones
85
+ * that carry no information for the server, deduplicating across interfaces and capping the
86
+ * result at the maximum number of addresses the Mobius API accepts.
87
+ *
88
+ * @param sdp - Session Description Protocol string.
89
+ */
90
+ function getHostIpsFromSdp(sdp) {
91
+ var candidates = (sdp === null || sdp === void 0 ? void 0 : sdp.match(_constants2.SDP_HOST_CANDIDATE_REGEX)) || [];
92
+ return candidates.map(function (candidate) {
93
+ return candidate.split(' ')[_constants2.CANDIDATE_ADDRESS_INDEX];
94
+ }).filter(function (address, index, addresses) {
95
+ return !_constants2.EXCLUDED_HOST_IPS.includes(address) && addresses.indexOf(address) === index;
96
+ }).slice(0, _constants2.MAX_HOST_IPS);
97
+ }
98
+
99
+ /**
100
+ * Discovers the host ip addresses of this client for the Mobius payloads that report them.
101
+ *
102
+ * ICE candidates are the only place a browser exposes the addresses of the local interfaces, so
103
+ * a throwaway media connection is negotiated far enough to produce a local offer, and the
104
+ * addresses are read off its host candidates. It is configured like the connection of a call, so
105
+ * that the addresses reported on registration are the ones the first call will offer. The offer
106
+ * is discarded and the connection closed right after, which releases the ports that gathering
107
+ * bound.
108
+ *
109
+ * The addresses are stored for {@link getHostIps} to read when the registration is posted, and
110
+ * are replaced on every discovery, as the interfaces a client holds can change between one
111
+ * registration and the next. Any failure leaves none stored: they are supplementary and must
112
+ * never fail a registration.
113
+ *
114
+ * @param localAudioStream - Microphone stream of the client. Holding it is what grants this
115
+ * origin the media capture permission that makes browsers report the addresses rather than mDNS
116
+ * hostnames, and sending its track is what makes the offer match the one a call produces.
117
+ */
118
+ function discoverHostIps(_x) {
119
+ return _discoverHostIps.apply(this, arguments);
120
+ }
121
+ function _discoverHostIps() {
122
+ _discoverHostIps = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(localAudioStream) {
123
+ var logContext, connection, _connection, _t;
124
+ return _regenerator.default.wrap(function (_context) {
125
+ while (1) switch (_context.prev = _context.next) {
126
+ case 0:
127
+ logContext = {
128
+ file: _constants.CALL_UTILS_FILE,
129
+ method: 'discoverHostIps'
130
+ };
131
+ hostIps = [];
132
+ _context.prev = 1;
133
+ connection = new _internalMediaCore.RoapMediaConnection({
134
+ skipInactiveTransceivers: true,
135
+ iceServers: [],
136
+ iceCandidatesTimeout: _constants.ICE_CANDIDATES_TIMEOUT,
137
+ sdpMunging: {
138
+ convertPort9to0: true,
139
+ addContentSlides: false,
140
+ copyClineToSessionLevel: true
141
+ }
142
+ }, {
143
+ localTracks: {
144
+ audio: localAudioStream.outputStream.getAudioTracks()[0]
145
+ },
146
+ direction: {
147
+ audio: 'sendrecv',
148
+ video: 'inactive',
149
+ screenShareVideo: 'inactive'
150
+ }
151
+ }, 'WebexCallSDK-hostIpDiscovery');
152
+
153
+ /*
154
+ * The offer is emitted before initiateOffer() resolves, as the roap state machine preserves
155
+ * the order of the actions it runs once the offer has been created. Only the offer carries an
156
+ * sdp — the same event delivers the OK and error messages of a negotiation this throwaway
157
+ * connection never reaches.
158
+ */
159
+ connection.on(_internalMediaCore.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, function (event) {
160
+ if (event.roapMessage.messageType === 'OFFER') {
161
+ hostIps = getHostIpsFromSdp(event.roapMessage.sdp);
162
+ }
163
+ });
164
+ _context.next = 2;
165
+ return connection.initiateOffer();
166
+ case 2:
167
+ _Logger.default.info("Discovered ".concat(hostIps.length, " host ip(s)"), logContext);
168
+ _context.next = 4;
169
+ break;
170
+ case 3:
171
+ _context.prev = 3;
172
+ _t = _context["catch"](1);
173
+ hostIps = [];
174
+ _Logger.default.warn("Host ip discovery failed: ".concat(_t), logContext);
175
+ case 4:
176
+ _context.prev = 4;
177
+ (_connection = connection) === null || _connection === void 0 ? void 0 : _connection.close();
178
+ return _context.finish(4);
179
+ case 5:
180
+ case "end":
181
+ return _context.stop();
182
+ }
183
+ }, _callee, null, [[1, 3, 4, 5]]);
184
+ }));
185
+ return _discoverHostIps.apply(this, arguments);
186
+ }
187
+ //# sourceMappingURL=callUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_internalMediaCore","require","_constants","_Logger","_interopRequireDefault","_constants2","hostIps","modifySdpForIPv4","sdp","replace","ipv6CLineMatches","match","hasIPv6CLine","length","log","info","file","CALL_UTILS_FILE","method","ipv4CandidateMatch","ipv4Address","IPV4_FALLBACK_ADDRESS","concat","ipv4CandidateAdded","full","foundation","componentId","transport","priority","connectionAddress","port","candidateType","includes","newFoundation","_parseInt2","default","toString","error","warn","getHostIps","getHostIpsFromSdp","candidates","SDP_HOST_CANDIDATE_REGEX","map","candidate","split","CANDIDATE_ADDRESS_INDEX","filter","address","index","addresses","EXCLUDED_HOST_IPS","indexOf","slice","MAX_HOST_IPS","discoverHostIps","_x","_discoverHostIps","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","localAudioStream","logContext","connection","_connection","_t","wrap","_context","prev","next","RoapMediaConnection","skipInactiveTransceivers","iceServers","iceCandidatesTimeout","ICE_CANDIDATES_TIMEOUT","sdpMunging","convertPort9to0","addContentSlides","copyClineToSessionLevel","localTracks","audio","outputStream","getAudioTracks","direction","video","screenShareVideo","on","MediaConnectionEventNames","ROAP_MESSAGE_TO_SEND","event","roapMessage","messageType","initiateOffer","close","finish","stop"],"sources":["callUtils.ts"],"sourcesContent":["import {\n LocalMicrophoneStream,\n MediaConnectionEventNames,\n RoapMediaConnection,\n RoapMessageEvent,\n} from '@webex/internal-media-core';\nimport {CALL_UTILS_FILE, ICE_CANDIDATES_TIMEOUT} from '../CallingClient/constants';\nimport log from '../Logger';\nimport {\n CANDIDATE_ADDRESS_INDEX,\n EXCLUDED_HOST_IPS,\n IPV4_FALLBACK_ADDRESS,\n MAX_HOST_IPS,\n SDP_HOST_CANDIDATE_REGEX,\n} from './constants';\n\nlet hostIps: string[] = [];\n\n/**\n * Modifies SDP to replace IPv6 \"c=\" lines with IPv4.And adds an IPv4 candidate if none exists.\n *\n * @param sdp - Session Description Protocol string.\n * @returns Modified SDP string.\n */\nexport function modifySdpForIPv4(sdp: string): string {\n try {\n // Normalize line endings to avoid issues\n sdp = sdp.replace(/\\r\\n|\\r/g, '\\n');\n\n // Ensure consistent spacing without removing intentional indentation\n sdp = sdp.replace(/^[ \\t]+/gm, '');\n\n // Check if at least one IPv6 \"c=\" line is present\n const ipv6CLineMatches = sdp.match(/c=IN IP6 [\\da-f:.]+/gi) || [];\n const hasIPv6CLine = ipv6CLineMatches.length > 0;\n\n if (hasIPv6CLine) {\n log.info('Modifying SDP for IPv4 compatibility', {\n file: CALL_UTILS_FILE,\n method: 'modifySdpForIPv4',\n });\n\n // Extract an existing IPv4 candidate's IP, if available\n const ipv4CandidateMatch = sdp.match(/a=candidate:\\d+ \\d+ \\w+ \\d+ ([\\d.]+) \\d+ typ \\w+/);\n const ipv4Address = ipv4CandidateMatch?.[1] || IPV4_FALLBACK_ADDRESS; // Default fallback\n\n // Replace all IPv6 \"c=\" lines with IPv4 using the extracted IP (or default)\n sdp = sdp.replace(/c=IN IP6 [\\da-f:.]+/gi, `c=IN IP4 ${ipv4Address}`);\n\n // Ensure newline separation between candidate lines\n if (!ipv4CandidateMatch) {\n let ipv4CandidateAdded = false;\n\n sdp = sdp.replace(\n /(a=candidate:(\\d+) (\\d+) (\\w+) (\\d+) ([\\da-f:.]+) (\\d+) typ (\\w+)[^\\n]*)/g,\n (\n match: string,\n full: string,\n foundation: string,\n componentId: string,\n transport: string, // Supports both UDP and TCP\n priority: string,\n connectionAddress: string,\n port: string,\n candidateType: string\n ) => {\n if (!ipv4CandidateAdded && connectionAddress.includes(':')) {\n // Ensure it's IPv6 and only add once\n ipv4CandidateAdded = true;\n const newFoundation = (parseInt(foundation, 10) + 1).toString();\n\n return (\n `${full}\\n` +\n `a=candidate:${newFoundation} ${componentId} ${transport} ${priority} ${ipv4Address} ${port} typ ${candidateType} generation 0 network-id 1 network-cost 10`\n );\n }\n\n return match;\n }\n );\n }\n }\n\n return sdp;\n } catch (error) {\n log.warn(`Error modifying SDP for IPv4 compatibility: ${error}`, {\n file: CALL_UTILS_FILE,\n method: 'modifySdpForIPv4',\n });\n\n return sdp; // Return original SDP in case of an error\n }\n}\n\n/**\n * Host ip addresses of this client, as stored by the last {@link discoverHostIps}. Empty until\n * that discovery has resolved, and whenever it found or reported none.\n */\nexport function getHostIps(): string[] {\n return hostIps;\n}\n\n/**\n * Returns the host ip addresses advertised by the host candidates of an SDP, dropping the ones\n * that carry no information for the server, deduplicating across interfaces and capping the\n * result at the maximum number of addresses the Mobius API accepts.\n *\n * @param sdp - Session Description Protocol string.\n */\nexport function getHostIpsFromSdp(sdp?: string): string[] {\n const candidates = sdp?.match(SDP_HOST_CANDIDATE_REGEX) || [];\n\n return candidates\n .map((candidate) => candidate.split(' ')[CANDIDATE_ADDRESS_INDEX])\n .filter(\n (address, index, addresses) =>\n !EXCLUDED_HOST_IPS.includes(address) && addresses.indexOf(address) === index\n )\n .slice(0, MAX_HOST_IPS);\n}\n\n/**\n * Discovers the host ip addresses of this client for the Mobius payloads that report them.\n *\n * ICE candidates are the only place a browser exposes the addresses of the local interfaces, so\n * a throwaway media connection is negotiated far enough to produce a local offer, and the\n * addresses are read off its host candidates. It is configured like the connection of a call, so\n * that the addresses reported on registration are the ones the first call will offer. The offer\n * is discarded and the connection closed right after, which releases the ports that gathering\n * bound.\n *\n * The addresses are stored for {@link getHostIps} to read when the registration is posted, and\n * are replaced on every discovery, as the interfaces a client holds can change between one\n * registration and the next. Any failure leaves none stored: they are supplementary and must\n * never fail a registration.\n *\n * @param localAudioStream - Microphone stream of the client. Holding it is what grants this\n * origin the media capture permission that makes browsers report the addresses rather than mDNS\n * hostnames, and sending its track is what makes the offer match the one a call produces.\n */\nexport async function discoverHostIps(localAudioStream: LocalMicrophoneStream): Promise<void> {\n const logContext = {file: CALL_UTILS_FILE, method: 'discoverHostIps'};\n let connection: RoapMediaConnection | undefined;\n\n hostIps = [];\n\n try {\n connection = new RoapMediaConnection(\n {\n skipInactiveTransceivers: true,\n iceServers: [],\n iceCandidatesTimeout: ICE_CANDIDATES_TIMEOUT,\n sdpMunging: {\n convertPort9to0: true,\n addContentSlides: false,\n copyClineToSessionLevel: true,\n },\n },\n {\n localTracks: {audio: localAudioStream.outputStream.getAudioTracks()[0]},\n direction: {\n audio: 'sendrecv',\n video: 'inactive',\n screenShareVideo: 'inactive',\n },\n },\n 'WebexCallSDK-hostIpDiscovery'\n );\n\n /*\n * The offer is emitted before initiateOffer() resolves, as the roap state machine preserves\n * the order of the actions it runs once the offer has been created. Only the offer carries an\n * sdp — the same event delivers the OK and error messages of a negotiation this throwaway\n * connection never reaches.\n */\n connection.on(MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND, (event: RoapMessageEvent) => {\n if (event.roapMessage.messageType === 'OFFER') {\n hostIps = getHostIpsFromSdp(event.roapMessage.sdp);\n }\n });\n\n await connection.initiateOffer();\n\n log.info(`Discovered ${hostIps.length} host ip(s)`, logContext);\n } catch (error) {\n hostIps = [];\n log.warn(`Host ip discovery failed: ${error}`, logContext);\n } finally {\n connection?.close();\n }\n}\n"],"mapp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AU;cACjBI,KAAK,EAAE,UAAU;cACjBC,gBAAgB,EAAE;YACpB;UACF,CAAC,EACD,8BACF,CAAC;;UAED;AACJ;AACA;AACA;AACA;AACA;UACItB,UAAU,CAACuB,EAAE,CAACC,4CAAyB,CAACC,oBAAoB,EAAE,UAACC,KAAuB,EAAK;YACzF,IAAIA,KAAK,CAACC,WAAW,CAACC,WAAW,KAAK,OAAO,EAAE;cAC7CxF,OAAO,GAAGkC,iBAAiB,CAACoD,KAAK,CAACC,WAAW,CAACrF,GAAG,CAAC;YACpD;UACF,CAAC,CAAC;UAAC8D,QAAA,CAAAE,IAAA;UAAA,OAEGN,UAAU,CAAC6B,aAAa,CAAC,CAAC;QAAA;UAEhCjF,eAAG,CAACC,IAAI,eAAAO,MAAA,CAAehB,OAAO,CAACO,MAAM,kBAAeoD,UAAU,CAAC;UAACK,QAAA,CAAAE,IAAA;UAAA;QAAA;UAAAF,QAAA,CAAAC,IAAA;UAAAH,EAAA,GAAAE,QAAA;UAEhEhE,OAAO,GAAG,EAAE;UACZQ,eAAG,CAACwB,IAAI,8BAAAhB,MAAA,CAAA8C,EAAA,GAAuCH,UAAU,CAAC;QAAC;UAAAK,QAAA,CAAAC,IAAA;UAE3D,CAAAJ,WAAA,GAAAD,UAAU,cAAAC,WAAA,uBAAVA,WAAA,CAAY6B,KAAK,CAAC,CAAC;UAAC,OAAA1B,QAAA,CAAA2B,MAAA;QAAA;QAAA;UAAA,OAAA3B,QAAA,CAAA4B,IAAA;MAAA;IAAA,GAAAnC,OAAA;EAAA,CAEvB;EAAA,OAAAN,gBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,313 @@
1
+ "use strict";
2
+
3
+ var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
4
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
5
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
6
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
7
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
8
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
9
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
10
+ var _from = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/from"));
11
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
13
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
15
+ var _internalMediaCore = require("@webex/internal-media-core");
16
+ var _constants = require("../CallingClient/constants");
17
+ var _constants2 = require("./constants");
18
+ var _callUtils = require("./callUtils");
19
+ function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable global-require */
21
+ var mockRoapMediaConnectionOn = jest.fn();
22
+ var mockRoapMediaConnectionInitiateOffer = jest.fn();
23
+ var mockRoapMediaConnectionClose = jest.fn();
24
+ var mockRoapMediaConnection = jest.fn().mockImplementation(function () {
25
+ return {
26
+ on: mockRoapMediaConnectionOn,
27
+ initiateOffer: mockRoapMediaConnectionInitiateOffer,
28
+ close: mockRoapMediaConnectionClose
29
+ };
30
+ });
31
+ jest.mock('@webex/internal-media-core', function () {
32
+ return _objectSpread(_objectSpread({}, jest.requireActual('@webex/internal-media-core')), {}, {
33
+ RoapMediaConnection: jest.fn().mockImplementation(function () {
34
+ return mockRoapMediaConnection.apply(void 0, arguments);
35
+ })
36
+ });
37
+ });
38
+ describe('Host ips', function () {
39
+ /* Reloaded for every test, as the discovered addresses are stored in the module. */
40
+ var hostIpUtils;
41
+ var localAudioTrack = {
42
+ id: 'audio-track'
43
+ };
44
+ var localAudioStream = {
45
+ outputStream: {
46
+ getAudioTracks: function getAudioTracks() {
47
+ return [localAudioTrack];
48
+ }
49
+ }
50
+ };
51
+ var sdpWithCandidates = function sdpWithCandidates() {
52
+ for (var _len = arguments.length, candidates = new Array(_len), _key = 0; _key < _len; _key++) {
53
+ candidates[_key] = arguments[_key];
54
+ }
55
+ return ['v=0', 'm=audio 9 UDP/TLS/RTP/SAVPF 111'].concat(candidates).join('\r\n');
56
+ };
57
+ var hostCandidate = function hostCandidate(address) {
58
+ var port = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 54321;
59
+ return "a=candidate:1 1 UDP 2130706431 ".concat(address, " ").concat(port, " typ host generation 0");
60
+ };
61
+
62
+ /**
63
+ * Makes the media connection emit an offer carrying the given candidates once its negotiation
64
+ * is initiated, followed by any trailing roap messages, or fail that negotiation.
65
+ */
66
+ var mockMediaConnection = function mockMediaConnection() {
67
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
68
+ _ref$candidates = _ref.candidates,
69
+ candidates = _ref$candidates === void 0 ? [] : _ref$candidates,
70
+ _ref$failing = _ref.failing,
71
+ failing = _ref$failing === void 0 ? false : _ref$failing,
72
+ _ref$trailingMessages = _ref.trailingMessages,
73
+ trailingMessages = _ref$trailingMessages === void 0 ? [] : _ref$trailingMessages;
74
+ var handlers = {};
75
+ mockRoapMediaConnectionOn.mockImplementation(function (event, handler) {
76
+ handlers[event] = handler;
77
+ });
78
+ mockRoapMediaConnectionInitiateOffer.mockImplementation(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
79
+ var emit;
80
+ return _regenerator.default.wrap(function (_context) {
81
+ while (1) switch (_context.prev = _context.next) {
82
+ case 0:
83
+ if (!failing) {
84
+ _context.next = 1;
85
+ break;
86
+ }
87
+ throw new Error('offer creation failed');
88
+ case 1:
89
+ emit = handlers[_internalMediaCore.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND];
90
+ emit === null || emit === void 0 ? void 0 : emit({
91
+ roapMessage: {
92
+ messageType: 'OFFER',
93
+ seq: 1,
94
+ sdp: sdpWithCandidates.apply(void 0, (0, _toConsumableArray2.default)(candidates))
95
+ }
96
+ });
97
+ trailingMessages.forEach(function (roapMessage) {
98
+ return emit === null || emit === void 0 ? void 0 : emit({
99
+ roapMessage: roapMessage
100
+ });
101
+ });
102
+ case 2:
103
+ case "end":
104
+ return _context.stop();
105
+ }
106
+ }, _callee);
107
+ })));
108
+ };
109
+ beforeEach(function () {
110
+ jest.clearAllMocks();
111
+ jest.resetModules();
112
+ hostIpUtils = require('./callUtils');
113
+ });
114
+ describe('getHostIpsFromSdp', function () {
115
+ it.each([['host candidates of every interface', [hostCandidate('10.0.0.5'), hostCandidate('192.168.1.7', 54322)], ['10.0.0.5', '192.168.1.7']], ['IPv6 host candidates', [hostCandidate('2001:db8::1')], ['2001:db8::1']], ['no server reflexive candidates', ['a=candidate:2 1 UDP 1694498815 203.0.113.9 54321 typ srflx raddr 10.0.0.5 rport 54321'], []], ['no loopback or unspecified addresses', [hostCandidate('127.0.0.1'), hostCandidate('::1'), hostCandidate('0.0.0.0')], []], ['no synthesised IPv4 fallback address', [hostCandidate(_constants2.IPV4_FALLBACK_ADDRESS)], []], ['no duplicates across media sections', [hostCandidate('10.0.0.5'), hostCandidate('10.0.0.5', 54322)], ['10.0.0.5']]])('reports %s', function (_name, candidates, expected) {
116
+ expect(hostIpUtils.getHostIpsFromSdp(sdpWithCandidates.apply(void 0, (0, _toConsumableArray2.default)(candidates)))).toEqual(expected);
117
+ });
118
+ it('reports nothing when there is no sdp', function () {
119
+ expect(hostIpUtils.getHostIpsFromSdp()).toEqual([]);
120
+ });
121
+ it('reports no more addresses than the Mobius api accepts', function () {
122
+ var candidates = (0, _from.default)({
123
+ length: _constants2.MAX_HOST_IPS + 5
124
+ }, function (_value, index) {
125
+ return hostCandidate("10.0.0.".concat(index));
126
+ });
127
+ expect(hostIpUtils.getHostIpsFromSdp(sdpWithCandidates.apply(void 0, (0, _toConsumableArray2.default)(candidates)))).toHaveLength(_constants2.MAX_HOST_IPS);
128
+ });
129
+ });
130
+ describe('discoverHostIps', function () {
131
+ it('negotiates the offer with the configuration a call uses', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
132
+ return _regenerator.default.wrap(function (_context2) {
133
+ while (1) switch (_context2.prev = _context2.next) {
134
+ case 0:
135
+ mockMediaConnection();
136
+ _context2.next = 1;
137
+ return hostIpUtils.discoverHostIps(localAudioStream);
138
+ case 1:
139
+ expect(mockRoapMediaConnection).toHaveBeenCalledWith({
140
+ skipInactiveTransceivers: true,
141
+ iceServers: [],
142
+ iceCandidatesTimeout: _constants.ICE_CANDIDATES_TIMEOUT,
143
+ sdpMunging: {
144
+ convertPort9to0: true,
145
+ addContentSlides: false,
146
+ copyClineToSessionLevel: true
147
+ }
148
+ }, {
149
+ localTracks: {
150
+ audio: localAudioTrack
151
+ },
152
+ direction: {
153
+ audio: 'sendrecv',
154
+ video: 'inactive',
155
+ screenShareVideo: 'inactive'
156
+ }
157
+ }, 'WebexCallSDK-hostIpDiscovery');
158
+ case 2:
159
+ case "end":
160
+ return _context2.stop();
161
+ }
162
+ }, _callee2);
163
+ })));
164
+ it('stores the host addresses of the offer and closes the connection', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
165
+ return _regenerator.default.wrap(function (_context3) {
166
+ while (1) switch (_context3.prev = _context3.next) {
167
+ case 0:
168
+ mockMediaConnection({
169
+ candidates: [hostCandidate('10.0.0.5'), 'a=candidate:2 1 UDP 1694498815 203.0.113.9 54321 typ srflx raddr 10.0.0.5 rport 54321']
170
+ });
171
+ _context3.next = 1;
172
+ return hostIpUtils.discoverHostIps(localAudioStream);
173
+ case 1:
174
+ expect(hostIpUtils.getHostIps()).toEqual(['10.0.0.5']);
175
+ expect(mockRoapMediaConnectionClose).toHaveBeenCalledTimes(1);
176
+ case 2:
177
+ case "end":
178
+ return _context3.stop();
179
+ }
180
+ }, _callee3);
181
+ })));
182
+ it('keeps the addresses of the offer when a later roap message carries no sdp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
183
+ return _regenerator.default.wrap(function (_context4) {
184
+ while (1) switch (_context4.prev = _context4.next) {
185
+ case 0:
186
+ mockMediaConnection({
187
+ candidates: [hostCandidate('10.0.0.5')],
188
+ trailingMessages: [{
189
+ messageType: 'OK',
190
+ seq: 1
191
+ }]
192
+ });
193
+ _context4.next = 1;
194
+ return hostIpUtils.discoverHostIps(localAudioStream);
195
+ case 1:
196
+ expect(hostIpUtils.getHostIps()).toEqual(['10.0.0.5']);
197
+ case 2:
198
+ case "end":
199
+ return _context4.stop();
200
+ }
201
+ }, _callee4);
202
+ })));
203
+ it('negotiates again on every discovery, storing the addresses of that moment', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
204
+ return _regenerator.default.wrap(function (_context5) {
205
+ while (1) switch (_context5.prev = _context5.next) {
206
+ case 0:
207
+ mockMediaConnection({
208
+ candidates: [hostCandidate('10.0.0.5')]
209
+ });
210
+ _context5.next = 1;
211
+ return hostIpUtils.discoverHostIps(localAudioStream);
212
+ case 1:
213
+ expect(hostIpUtils.getHostIps()).toEqual(['10.0.0.5']);
214
+ mockMediaConnection({
215
+ candidates: [hostCandidate('192.168.1.7')]
216
+ });
217
+ _context5.next = 2;
218
+ return hostIpUtils.discoverHostIps(localAudioStream);
219
+ case 2:
220
+ expect(hostIpUtils.getHostIps()).toEqual(['192.168.1.7']);
221
+ expect(mockRoapMediaConnectionInitiateOffer).toHaveBeenCalledTimes(2);
222
+ case 3:
223
+ case "end":
224
+ return _context5.stop();
225
+ }
226
+ }, _callee5);
227
+ })));
228
+ it.each([['the negotiation fails', function () {
229
+ return mockMediaConnection({
230
+ failing: true
231
+ });
232
+ }, 1], ['the media connection cannot be created', function () {
233
+ return mockRoapMediaConnection.mockImplementationOnce(function () {
234
+ throw new Error('RTCPeerConnection API is not available in this environment');
235
+ });
236
+ }, 0]])('stores nothing when %s', /*#__PURE__*/function () {
237
+ var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(_name, failConnection, expectedCloses) {
238
+ return _regenerator.default.wrap(function (_context6) {
239
+ while (1) switch (_context6.prev = _context6.next) {
240
+ case 0:
241
+ mockMediaConnection({
242
+ candidates: [hostCandidate('10.0.0.5')]
243
+ });
244
+ _context6.next = 1;
245
+ return hostIpUtils.discoverHostIps(localAudioStream);
246
+ case 1:
247
+ failConnection();
248
+ _context6.next = 2;
249
+ return hostIpUtils.discoverHostIps(localAudioStream);
250
+ case 2:
251
+ expect(hostIpUtils.getHostIps()).toEqual([]);
252
+ expect(mockRoapMediaConnectionClose).toHaveBeenCalledTimes(expectedCloses + 1);
253
+ case 3:
254
+ case "end":
255
+ return _context6.stop();
256
+ }
257
+ }, _callee6);
258
+ }));
259
+ return function (_x, _x2, _x3) {
260
+ return _ref7.apply(this, arguments);
261
+ };
262
+ }());
263
+ });
264
+ });
265
+ describe('modifySdpForIPv4', function () {
266
+ it('should return original SDP if input is empty', function () {
267
+ expect((0, _callUtils.modifySdpForIPv4)('')).toBe('');
268
+ });
269
+ it('should return original SDP if there is no IPv6 c= line', function () {
270
+ var sdp = "v=0\no=- 12345 67890 IN IP4 192.168.1.1\n\ns=Test Session";
271
+ expect((0, _callUtils.modifySdpForIPv4)(sdp)).toEqual(sdp);
272
+ });
273
+ it('should replace IPv6 c= line with default IPv4 if no IPv4 candidate exists', function () {
274
+ var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
275
+ var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10";
276
+ var result = (0, _callUtils.modifySdpForIPv4)(sdp);
277
+ expect(result).toEqual(expectedSdp);
278
+ });
279
+ it('should replace IPv6 c= line with an existing IPv4 candidate address', function () {
280
+ var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 192.168.1.2 3478 typ host";
281
+ var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.168.1.2\na=candidate:1 1 UDP 2122260223 192.168.1.2 3478 typ host";
282
+ expect((0, _callUtils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
283
+ });
284
+ it('should correctly handle both UDP and TCP candidates by adding only one IPv4 candidate UDP first', function () {
285
+ var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\n a=candidate:2 1 TCP 2122260223 2001:db8::2 3479 typ host";
286
+ var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10\na=candidate:2 1 TCP 2122260223 2001:db8::2 3479 typ host\n";
287
+ expect((0, _callUtils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
288
+ });
289
+ it('should correctly handle both UDP and TCP candidates by adding only one IPv4 candidate TCP first', function () {
290
+ var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 TCP 2122260223 2001:db8::2 3479 typ host\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
291
+ var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 TCP 2122260223 2001:db8::2 3479 typ host\na=candidate:2 1 TCP 2122260223 192.1.1.1 3479 typ host generation 0 network-id 1 network-cost 10\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
292
+ expect((0, _callUtils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
293
+ });
294
+ it('should replace all IPv6 c= line if multiple exist', function () {
295
+ var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n c=IN IP6 2001:db8::2\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
296
+ var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10";
297
+ expect((0, _callUtils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
298
+ });
299
+ it('should not modify SDP if IPv6 c= line is absent and IPv4 candidate already exists', function () {
300
+ var sdp = "v=0\no=- 12345 67890 IN IP4 192.168.1.1\ns=Test Session\nc=IN IP4 192.168.1.1\na=candidate:1 1 UDP 2122260223 192.168.1.1 3478 typ host";
301
+ expect((0, _callUtils.modifySdpForIPv4)(sdp).trim()).toEqual(sdp.trim());
302
+ });
303
+ it('should handle malformed SDP gracefully and return unmodified input', function () {
304
+ var malformedSdp = "random text without proper format";
305
+ expect((0, _callUtils.modifySdpForIPv4)(malformedSdp).trim()).toEqual(malformedSdp.trim());
306
+ });
307
+ it('should handle an SDP with both IP6 and IP4 c= lines correctly', function () {
308
+ var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n c=IN IP4 192.168.1.3\n a=candidate:1 1 UDP 2122260223 192.168.1.3 3478 typ host";
309
+ var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.168.1.3\nc=IN IP4 192.168.1.3\na=candidate:1 1 UDP 2122260223 192.168.1.3 3478 typ host";
310
+ expect((0, _callUtils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
311
+ });
312
+ });
313
+ //# sourceMappingURL=callUtils.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_internalMediaCore","require","_constants","_constants2","_callUtils","ownKeys","e","r","t","_Object$keys","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","mockRoapMediaConnectionOn","jest","fn","mockRoapMediaConnectionInitiateOffer","mockRoapMediaConnectionClose","mockRoapMediaConnection","mockImplementation","on","initiateOffer","close","mock","requireActual","RoapMediaConnection","describe","hostIpUtils","localAudioTrack","id","localAudioStream","outputStream","getAudioTracks","sdpWithCandidates","_len","candidates","Array","_key","concat","join","hostCandidate","address","port","undefined","mockMediaConnection","_ref","_ref$candidates","_ref$failing","failing","_ref$trailingMessages","trailingMessages","handlers","event","handler","_asyncToGenerator2","_regenerator","mark","_callee","emit","wrap","_context","prev","next","Error","MediaConnectionEventNames","ROAP_MESSAGE_TO_SEND","roapMessage","messageType","seq","sdp","_toConsumableArray2","stop","beforeEach","clearAllMocks","resetModules","it","each","IPV4_FALLBACK_ADDRESS","_name","expected","expect","getHostIpsFromSdp","toEqual","_from","MAX_HOST_IPS","_value","index","toHaveLength","_callee2","_context2","discoverHostIps","toHaveBeenCalledWith","skipInactiveTransceivers","iceServers","iceCandidatesTimeout","ICE_CANDIDATES_TIMEOUT","sdpMunging","convertPort9to0","addContentSlides","copyClineToSessionLevel","localTracks","audio","direction","video","screenShareVideo","_callee3","_context3","getHostIps","toHaveBeenCalledTimes","_callee4","_context4","_callee5","_context5","mockImplementationOnce","_ref7","_callee6","failConnection","expectedCloses","_context6","_x","_x2","_x3","modifySdpForIPv4","toBe","expectedSdp","result","trim","malformedSdp"],"sources":["callUtils.test.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/* eslint-disable global-require */\nimport {LocalMicrophoneStream, MediaConnectionEventNames} from '@webex/internal-media-core';\nimport {ICE_CANDIDATES_TIMEOUT} from '../CallingClient/constants';\nimport {IPV4_FALLBACK_ADDRESS, MAX_HOST_IPS} from './constants';\nimport {modifySdpForIPv4} from './callUtils';\n\nconst mockRoapMediaConnectionOn = jest.fn();\nconst mockRoapMediaConnectionInitiateOffer = jest.fn();\nconst mockRoapMediaConnectionClose = jest.fn();\nconst mockRoapMediaConnection = jest.fn().mockImplementation(() => ({\n on: mockRoapMediaConnectionOn,\n initiateOffer: mockRoapMediaConnectionInitiateOffer,\n close: mockRoapMediaConnectionClose,\n}));\n\njest.mock('@webex/internal-media-core', () => ({\n ...jest.requireActual('@webex/internal-media-core'),\n RoapMediaConnection: jest\n .fn()\n .mockImplementation((...args: unknown[]) => mockRoapMediaConnection(...args)),\n}));\n\ndescribe('Host ips', () => {\n /* Reloaded for every test, as the discovered addresses are stored in the module. */\n let hostIpUtils: typeof import('./callUtils');\n\n const localAudioTrack = {id: 'audio-track'} as MediaStreamTrack;\n const localAudioStream = {\n outputStream: {getAudioTracks: () => [localAudioTrack]},\n } as unknown as LocalMicrophoneStream;\n\n const sdpWithCandidates = (...candidates: string[]) =>\n ['v=0', 'm=audio 9 UDP/TLS/RTP/SAVPF 111', ...candidates].join('\\r\\n');\n\n const hostCandidate = (address: string, port = 54321) =>\n `a=candidate:1 1 UDP 2130706431 ${address} ${port} typ host generation 0`;\n\n /**\n * Makes the media connection emit an offer carrying the given candidates once its negotiation\n * is initiated, followed by any trailing roap messages, or fail that negotiation.\n */\n const mockMediaConnection = ({\n candidates = [] as string[],\n failing = false,\n trailingMessages = [] as Array<Record<string, unknown>>,\n } = {}) => {\n const handlers: Record<string, (event: unknown) => void> = {};\n\n mockRoapMediaConnectionOn.mockImplementation(\n (event: string, handler: (event: unknown) => void) => {\n handlers[event] = handler;\n }\n );\n\n mockRoapMediaConnectionInitiateOffer.mockImplementation(async () => {\n if (failing) {\n throw new Error('offer creation failed');\n }\n\n const emit = handlers[MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND];\n\n emit?.({\n roapMessage: {messageType: 'OFFER', seq: 1, sdp: sdpWithCandidates(...candidates)},\n });\n trailingMessages.forEach((roapMessage) => emit?.({roapMessage}));\n });\n };\n\n beforeEach(() => {\n jest.clearAllMocks();\n jest.resetModules();\n hostIpUtils = require('./callUtils');\n });\n\n describe('getHostIpsFromSdp', () => {\n it.each([\n [\n 'host candidates of every interface',\n [hostCandidate('10.0.0.5'), hostCandidate('192.168.1.7', 54322)],\n ['10.0.0.5', '192.168.1.7'],\n ],\n ['IPv6 host candidates', [hostCandidate('2001:db8::1')], ['2001:db8::1']],\n [\n 'no server reflexive candidates',\n ['a=candidate:2 1 UDP 1694498815 203.0.113.9 54321 typ srflx raddr 10.0.0.5 rport 54321'],\n [],\n ],\n [\n 'no loopback or unspecified addresses',\n [hostCandidate('127.0.0.1'), hostCandidate('::1'), hostCandidate('0.0.0.0')],\n [],\n ],\n ['no synthesised IPv4 fallback address', [hostCandidate(IPV4_FALLBACK_ADDRESS)], []],\n [\n 'no duplicates across media sections',\n [hostCandidate('10.0.0.5'), hostCandidate('10.0.0.5', 54322)],\n ['10.0.0.5'],\n ],\n ])('reports %s', (_name, candidates, expected) => {\n expect(hostIpUtils.getHostIpsFromSdp(sdpWithCandidates(...candidates))).toEqual(expected);\n });\n\n it('reports nothing when there is no sdp', () => {\n expect(hostIpUtils.getHostIpsFromSdp()).toEqual([]);\n });\n\n it('reports no more addresses than the Mobius api accepts', () => {\n const candidates = Array.from({length: MAX_HOST_IPS + 5}, (_value, index) =>\n hostCandidate(`10.0.0.${index}`)\n );\n\n expect(hostIpUtils.getHostIpsFromSdp(sdpWithCandidates(...candidates))).toHaveLength(\n MAX_HOST_IPS\n );\n });\n });\n\n describe('discoverHostIps', () => {\n it('negotiates the offer with the configuration a call uses', async () => {\n mockMediaConnection();\n\n await hostIpUtils.discoverHostIps(localAudioStream);\n\n expect(mockRoapMediaConnection).toHaveBeenCalledWith(\n {\n skipInactiveTransceivers: true,\n iceServers: [],\n iceCandidatesTimeout: ICE_CANDIDATES_TIMEOUT,\n sdpMunging: {\n convertPort9to0: true,\n addContentSlides: false,\n copyClineToSessionLevel: true,\n },\n },\n {\n localTracks: {audio: localAudioTrack},\n direction: {audio: 'sendrecv', video: 'inactive', screenShareVideo: 'inactive'},\n },\n 'WebexCallSDK-hostIpDiscovery'\n );\n });\n\n it('stores the host addresses of the offer and closes the connection', async () => {\n mockMediaConnection({\n candidates: [\n hostCandidate('10.0.0.5'),\n 'a=candidate:2 1 UDP 1694498815 203.0.113.9 54321 typ srflx raddr 10.0.0.5 rport 54321',\n ],\n });\n\n await hostIpUtils.discoverHostIps(localAudioStream);\n\n expect(hostIpUtils.getHostIps()).toEqual(['10.0.0.5']);\n expect(mockRoapMediaConnectionClose).toHaveBeenCalledTimes(1);\n });\n\n it('keeps the addresses of the offer when a later roap message carries no sdp', async () => {\n mockMediaConnection({\n candidates: [hostCandidate('10.0.0.5')],\n trailingMessages: [{messageType: 'OK', seq: 1}],\n });\n\n await hostIpUtils.discoverHostIps(localAudioStream);\n\n expect(hostIpUtils.getHostIps()).toEqual(['10.0.0.5']);\n });\n\n it('negotiates again on every discovery, storing the addresses of that moment', async () => {\n mockMediaConnection({candidates: [hostCandidate('10.0.0.5')]});\n await hostIpUtils.discoverHostIps(localAudioStream);\n\n expect(hostIpUtils.getHostIps()).toEqual(['10.0.0.5']);\n\n mockMediaConnection({candidates: [hostCandidate('192.168.1.7')]});\n await hostIpUtils.discoverHostIps(localAudioStream);\n\n expect(hostIpUtils.getHostIps()).toEqual(['192.168.1.7']);\n expect(mockRoapMediaConnectionInitiateOffer).toHaveBeenCalledTimes(2);\n });\n\n it.each([\n ['the negotiation fails', () => mockMediaConnection({failing: true}), 1],\n [\n 'the media connection cannot be created',\n () =>\n mockRoapMediaConnection.mockImplementationOnce(() => {\n throw new Error('RTCPeerConnection API is not available in this environment');\n }),\n 0,\n ],\n ])('stores nothing when %s', async (_name, failConnection, expectedCloses) => {\n mockMediaConnection({candidates: [hostCandidate('10.0.0.5')]});\n await hostIpUtils.discoverHostIps(localAudioStream);\n\n failConnection();\n await hostIpUtils.discoverHostIps(localAudioStream);\n\n expect(hostIpUtils.getHostIps()).toEqual([]);\n expect(mockRoapMediaConnectionClose).toHaveBeenCalledTimes(expectedCloses + 1);\n });\n });\n});\n\ndescribe('modifySdpForIPv4', () => {\n it('should return original SDP if input is empty', () => {\n expect(modifySdpForIPv4('')).toBe('');\n });\n\n it('should return original SDP if there is no IPv6 c= line', () => {\n const sdp = `v=0\\no=- 12345 67890 IN IP4 192.168.1.1\\n\\ns=Test Session`;\n expect(modifySdpForIPv4(sdp)).toEqual(sdp);\n });\n\n it('should replace IPv6 c= line with default IPv4 if no IPv4 candidate exists', () => {\n const sdp = `v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host`;\n\n const expectedSdp = `v=0\\no=- 12345 67890 IN IP6 2001:db8::1\\ns=Test Session\\nc=IN IP4 192.1.1.1\\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10`;\n const result = modifySdpForIPv4(sdp);\n expect(result).toEqual(expectedSdp);\n });\n\n it('should replace IPv6 c= line with an existing IPv4 candidate address', () => {\n const sdp = `v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 192.168.1.2 3478 typ host`;\n\n const expectedSdp = `v=0\\no=- 12345 67890 IN IP6 2001:db8::1\\ns=Test Session\\nc=IN IP4 192.168.1.2\\na=candidate:1 1 UDP 2122260223 192.168.1.2 3478 typ host`;\n\n expect(modifySdpForIPv4(sdp).trim()).toEqual(expectedSdp.trim());\n });\n\n it('should correctly handle both UDP and TCP candidates by adding only one IPv4 candidate UDP first', () => {\n const sdp = `v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\n a=candidate:2 1 TCP 2122260223 2001:db8::2 3479 typ host`;\n\n const expectedSdp = `v=0\\no=- 12345 67890 IN IP6 2001:db8::1\\ns=Test Session\\nc=IN IP4 192.1.1.1\\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10\\na=candidate:2 1 TCP 2122260223 2001:db8::2 3479 typ host\\n`;\n\n expect(modifySdpForIPv4(sdp).trim()).toEqual(expectedSdp.trim());\n });\n\n it('should correctly handle both UDP and TCP candidates by adding only one IPv4 candidate TCP first', () => {\n const sdp = `v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 TCP 2122260223 2001:db8::2 3479 typ host\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host`;\n\n const expectedSdp = `v=0\\no=- 12345 67890 IN IP6 2001:db8::1\\ns=Test Session\\nc=IN IP4 192.1.1.1\\na=candidate:1 1 TCP 2122260223 2001:db8::2 3479 typ host\\na=candidate:2 1 TCP 2122260223 192.1.1.1 3479 typ host generation 0 network-id 1 network-cost 10\\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host`;\n\n expect(modifySdpForIPv4(sdp).trim()).toEqual(expectedSdp.trim());\n });\n\n it('should replace all IPv6 c= line if multiple exist', () => {\n const sdp = `v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n c=IN IP6 2001:db8::2\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host`;\n\n const expectedSdp = `v=0\\no=- 12345 67890 IN IP6 2001:db8::1\\ns=Test Session\\nc=IN IP4 192.1.1.1\\nc=IN IP4 192.1.1.1\\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10`;\n\n expect(modifySdpForIPv4(sdp).trim()).toEqual(expectedSdp.trim());\n });\n\n it('should not modify SDP if IPv6 c= line is absent and IPv4 candidate already exists', () => {\n const sdp = `v=0\\no=- 12345 67890 IN IP4 192.168.1.1\\ns=Test Session\\nc=IN IP4 192.168.1.1\\na=candidate:1 1 UDP 2122260223 192.168.1.1 3478 typ host`;\n\n expect(modifySdpForIPv4(sdp).trim()).toEqual(sdp.trim());\n });\n\n it('should handle malformed SDP gracefully and return unmodified input', () => {\n const malformedSdp = `random text without proper format`;\n\n expect(modifySdpForIPv4(malformedSdp).trim()).toEqual(malformedSdp.trim());\n });\n\n it('should handle an SDP with both IP6 and IP4 c= lines correctly', () => {\n const sdp = `v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n c=IN IP4 192.168.1.3\n a=candidate:1 1 UDP 2122260223 192.168.1.3 3478 typ host`;\n\n const expectedSdp = `v=0\\no=- 12345 67890 IN IP6 2001:db8::1\\ns=Test Session\\nc=IN IP4 192.168.1.3\\nc=IN IP4 192.168.1.3\\na=candidate:1 1 UDP 2122260223 192.168.1.3 3478 typ host`;\n\n expect(modifySdpForIPv4(sdp).trim()).toEqual(expectedSdp.trim());\n });\n});\n"],"mappings":";;;;;;;;;;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA6C,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAH,CAAA,OAAAI,6BAAA,QAAAC,CAAA,GAAAD,6BAAA,CAAAJ,CAAA,GAAAC,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAM,gCAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAAAG,CAAA,YAAAH,CAAA;AAAA,SAAAS,cAAAX,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAW,SAAA,CAAAC,MAAA,EAAAZ,CAAA,UAAAC,CAAA,WAAAU,SAAA,CAAAX,CAAA,IAAAW,SAAA,CAAAX,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAe,MAAA,CAAAZ,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,CAAAC,OAAA,EAAAjB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAiB,iCAAA,GAAAC,wBAAA,CAAAnB,CAAA,EAAAkB,iCAAA,C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5
5
  value: true
6
6
  });
7
- exports.XSI_ACTION_ENDPOINT_ORG_URL_PARAM = exports.XSI_ACTION_ENDPOINT = exports.XML_TYPE = exports.WEBEX_CALLING_CONNECTOR_FILE = exports.WEBEX_API_PROD = exports.WEBEX_API_FEDRAMP = exports.WEBEX_API_CONFIG_PROD_URL = exports.WEBEX_API_CONFIG_INT_URL = exports.WEBEX_API_CONFIG_FEDRAMP_URL = exports.WEBEX_API_BTS = exports.VOICEMAIL = exports.VALUES = exports.USER_SESSIONS = exports.USERS = exports.USER = exports.UNPROCESSABLE_CONTENT_CODE = exports.UCM_CONNECTOR_FILE = exports.TRANSCRIPT = exports.TOKEN = exports.TIME = exports.SUCCESS_STATUS_CODE = exports.SUCCESS_MESSAGE = exports.STATUS_CODE = exports.SETTINGS = exports.SERVICES_ENDPOINT = exports.SCIM_WEBEXIDENTITY_USER = exports.SCIM_USER_FILTER = exports.SCIM_ENTERPRISE_USER = exports.SCIM_ENDPOINT_RESOURCE = exports.RESPONSE_MESSAGE = exports.RESPONSE_DATA = exports.RESPONSE = exports.RAW_REQUEST = exports.PLACEHOLDER_KEY = exports.OBJECT = exports.NATIVE_WEBEX_TEAMS_CALLING = exports.NATIVE_SIP_CALL_TO_UCM = exports.METHOD_START_MESSAGE = exports.KEY = exports.ITEMS = exports.INFER_ID_CONSTANT = exports.IDENTITY_ENDPOINT_RESOURCE = exports.FAILURE_MESSAGE = exports.ENTITLEMENT_STANDARD = exports.ENTITLEMENT_BROADWORKS_CONN = exports.ENTITLEMENT_BASIC = exports.DEVICES = exports.CONTENT = exports.BW_XSI_URL = exports.BW_XSI_ENDPOINT_VERSION_WITH_SLASH = exports.BW_XSI_ENDPOINT_VERSION = exports.BINARY = exports.BEARER = exports.BASE64 = void 0;
7
+ exports.XSI_ACTION_ENDPOINT_ORG_URL_PARAM = exports.XSI_ACTION_ENDPOINT = exports.XML_TYPE = exports.WEBEX_CALLING_CONNECTOR_FILE = exports.WEBEX_API_PROD = exports.WEBEX_API_FEDRAMP = exports.WEBEX_API_CONFIG_PROD_URL = exports.WEBEX_API_CONFIG_INT_URL = exports.WEBEX_API_CONFIG_FEDRAMP_URL = exports.WEBEX_API_BTS = exports.VOICEMAIL = exports.VALUES = exports.USER_SESSIONS = exports.USERS = exports.USER = exports.UNPROCESSABLE_CONTENT_CODE = exports.UCM_CONNECTOR_FILE = exports.TRANSCRIPT = exports.TOKEN = exports.TIME = exports.SUCCESS_STATUS_CODE = exports.SUCCESS_MESSAGE = exports.STATUS_CODE = exports.SETTINGS = exports.SERVICES_ENDPOINT = exports.SDP_HOST_CANDIDATE_REGEX = exports.SCIM_WEBEXIDENTITY_USER = exports.SCIM_USER_FILTER = exports.SCIM_ENTERPRISE_USER = exports.SCIM_ENDPOINT_RESOURCE = exports.RESPONSE_MESSAGE = exports.RESPONSE_DATA = exports.RESPONSE = exports.RAW_REQUEST = exports.PLACEHOLDER_KEY = exports.OBJECT = exports.NATIVE_WEBEX_TEAMS_CALLING = exports.NATIVE_SIP_CALL_TO_UCM = exports.MOBIUS_WSS_ALLOWED_DOMAINS = exports.METHOD_START_MESSAGE = exports.MAX_HOST_IPS = exports.KEY = exports.ITEMS = exports.IPV4_FALLBACK_ADDRESS = exports.INFER_ID_CONSTANT = exports.IDENTITY_ENDPOINT_RESOURCE = exports.FAILURE_MESSAGE = exports.EXCLUDED_HOST_IPS = exports.ENTITLEMENT_STANDARD = exports.ENTITLEMENT_BROADWORKS_CONN = exports.ENTITLEMENT_BASIC = exports.DEVICES = exports.CONTENT = exports.CANDIDATE_ADDRESS_INDEX = exports.BW_XSI_URL = exports.BW_XSI_ENDPOINT_VERSION_WITH_SLASH = exports.BW_XSI_ENDPOINT_VERSION = exports.BINARY = exports.BEARER = exports.BASE64 = void 0;
8
8
  var BASE64 = exports.BASE64 = 'base64';
9
9
  var BEARER = exports.BEARER = 'bearer';
10
10
  var BINARY = exports.BINARY = 'binary';
@@ -55,8 +55,34 @@ var SCIM_ENTERPRISE_USER = exports.SCIM_ENTERPRISE_USER = 'urn:ietf:params:scim:
55
55
  var WEBEX_API_PROD = exports.WEBEX_API_PROD = 'https://webexapis.com';
56
56
  var WEBEX_API_BTS = exports.WEBEX_API_BTS = 'https://integration.webexapis.com';
57
57
  var WEBEX_API_FEDRAMP = exports.WEBEX_API_FEDRAMP = 'https://api-usgov.webex.com';
58
+
59
+ /**
60
+ * Trusted domain suffixes for Mobius WSS connections (AC-2).
61
+ *
62
+ * A bearer token may only be transmitted over a WSS socket whose hostname
63
+ * ends with one of these domains. The list covers primary/backup Mobius
64
+ * infrastructure, the Webex API gateway, and FedRAMP variants.
65
+ */
66
+ var MOBIUS_WSS_ALLOWED_DOMAINS = exports.MOBIUS_WSS_ALLOWED_DOMAINS = ['webex.com', 'wbx2.com', 'webexapis.com', 'cisco.com'];
58
67
  var WEBEX_API_CONFIG_INT_URL = exports.WEBEX_API_CONFIG_INT_URL = "".concat(WEBEX_API_BTS, "/v1/uc/config");
59
68
  var WEBEX_API_CONFIG_PROD_URL = exports.WEBEX_API_CONFIG_PROD_URL = "".concat(WEBEX_API_PROD, "/v1/uc/config");
60
69
  var WEBEX_API_CONFIG_FEDRAMP_URL = exports.WEBEX_API_CONFIG_FEDRAMP_URL = "".concat(WEBEX_API_FEDRAMP, "/v1/uc/config");
61
70
  var METHOD_START_MESSAGE = exports.METHOD_START_MESSAGE = 'invoking';
71
+ /* Maximum number of host ip addresses accepted by the Mobius API. */
72
+ var MAX_HOST_IPS = exports.MAX_HOST_IPS = 10;
73
+ /* Address used in place of an IPv4 candidate when an SDP carries none. */
74
+ var IPV4_FALLBACK_ADDRESS = exports.IPV4_FALLBACK_ADDRESS = '192.1.1.1';
75
+ /*
76
+ * Matches the host candidate lines of an SDP, which carry the address in their fifth field:
77
+ * a=candidate:<foundation> <component> <transport> <priority> <address> <port> typ host ...
78
+ */
79
+ var SDP_HOST_CANDIDATE_REGEX = exports.SDP_HOST_CANDIDATE_REGEX = /^a=candidate:\S+ \d+ \S+ \d+ \S+ \d+ typ host[^\r\n]*/gim;
80
+ var CANDIDATE_ADDRESS_INDEX = exports.CANDIDATE_ADDRESS_INDEX = 4;
81
+ /*
82
+ * Addresses that identify no local interface the server could correlate against.
83
+ * IPV4_FALLBACK_ADDRESS is one of them because modifySdpForIPv4 synthesises a candidate with it
84
+ * when an SDP carries no IPv4 candidate, so it can appear as a host candidate of an offer
85
+ * without belonging to any interface of this client.
86
+ */
87
+ var EXCLUDED_HOST_IPS = exports.EXCLUDED_HOST_IPS = ['0.0.0.0', '::', '127.0.0.1', '::1', IPV4_FALLBACK_ADDRESS];
62
88
  //# sourceMappingURL=constants.js.map