You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CallStats.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /* global callstats */
  2. const logger = require('jitsi-meet-logger').getLogger(__filename);
  3. const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
  4. /**
  5. * We define enumeration of wrtcFuncNames as we need them before
  6. * callstats is initialized to queue events.
  7. * @const
  8. * @see http://www.callstats.io/api/#enumeration-of-wrtcfuncnames
  9. */
  10. const wrtcFuncNames = {
  11. createOffer: 'createOffer',
  12. createAnswer: 'createAnswer',
  13. setLocalDescription: 'setLocalDescription',
  14. setRemoteDescription: 'setRemoteDescription',
  15. addIceCandidate: 'addIceCandidate',
  16. getUserMedia: 'getUserMedia',
  17. iceConnectionFailure: 'iceConnectionFailure',
  18. signalingError: 'signalingError',
  19. applicationLog: 'applicationLog'
  20. };
  21. /**
  22. * We define enumeration of fabricEvent as we need them before
  23. * callstats is initialized to queue events.
  24. * @const
  25. * @see http://www.callstats.io/api/#enumeration-of-fabricevent
  26. */
  27. const fabricEvent = {
  28. fabricHold: 'fabricHold',
  29. fabricResume: 'fabricResume',
  30. audioMute: 'audioMute',
  31. audioUnmute: 'audioUnmute',
  32. videoPause: 'videoPause',
  33. videoResume: 'videoResume',
  34. fabricUsageEvent: 'fabricUsageEvent',
  35. fabricStats: 'fabricStats',
  36. fabricTerminated: 'fabricTerminated',
  37. screenShareStart: 'screenShareStart',
  38. screenShareStop: 'screenShareStop',
  39. dominantSpeaker: 'dominantSpeaker',
  40. activeDeviceList: 'activeDeviceList'
  41. };
  42. /**
  43. * The user id to report to callstats as destination.
  44. * @type {string}
  45. */
  46. const DEFAULT_REMOTE_USER = 'jitsi';
  47. /**
  48. * Type of pending reports, can be event or an error.
  49. * @type {{ERROR: string, EVENT: string}}
  50. */
  51. const reportType = {
  52. ERROR: 'error',
  53. EVENT: 'event',
  54. MST_WITH_USERID: 'mstWithUserID'
  55. };
  56. /**
  57. * Set of currently existing {@link CallStats} instances.
  58. * @type {Set<CallStats>}
  59. */
  60. let _fabrics;
  61. /**
  62. * An instance of this class is a wrapper for the CallStats API fabric. A fabric
  63. * reports one peer connection the the CallStats backend and is allocated with
  64. * {@link callstats.addNewFabric}. It has a bunch of instance methods for
  65. * reporting various events. A fabric is considered disposed when
  66. * {@link CallStats.sendTerminateEvent} is executed.
  67. *
  68. * Currently only one backend instance can be created ever and it's done using
  69. * {@link CallStats.initBackend}. At the time of this writing there is no way to
  70. * explicitly shutdown the backend, but it's supposed to close it's connection
  71. * automatically, after all fabrics have been terminated.
  72. */
  73. export default class CallStats {
  74. /**
  75. * A callback passed to {@link callstats.addNewFabric}.
  76. * @param {string} error 'success' means ok
  77. * @param {string} msg some more details
  78. * @private
  79. */
  80. static _addNewFabricCallback(error, msg) {
  81. if (CallStats.backend && error !== 'success') {
  82. logger.error(`Monitoring status: ${error} msg: ${msg}`);
  83. }
  84. }
  85. /**
  86. * Callback passed to {@link callstats.initialize} (backend initialization)
  87. * @param {string} error 'success' means ok
  88. * @param {String} msg
  89. * @private
  90. */
  91. static _initCallback(error, msg) {
  92. logger.log(`CallStats Status: err=${error} msg=${msg}`);
  93. // there is no lib, nothing to report to
  94. if (error !== 'success') {
  95. return;
  96. }
  97. // I hate that
  98. let atLeastOneFabric = false;
  99. let defaultInstance = null;
  100. for (const callStatsInstance of CallStats.fabrics.values()) {
  101. if (!callStatsInstance.hasFabric) {
  102. logger.debug('addNewFabric - initCallback');
  103. if (callStatsInstance._addNewFabric()) {
  104. atLeastOneFabric = true;
  105. if (!defaultInstance) {
  106. defaultInstance = callStatsInstance;
  107. }
  108. }
  109. }
  110. }
  111. if (!atLeastOneFabric) {
  112. return;
  113. }
  114. CallStats.initialized = true;
  115. // There is no conference ID nor a PeerConnection available when some of
  116. // the events are scheduled on the reportsQueue, so those will be
  117. // reported on the first initialized fabric.
  118. const defaultConfID = defaultInstance.confID;
  119. const defaultPC = defaultInstance.peerconnection;
  120. // notify callstats about failures if there were any
  121. for (const report of CallStats.reportsQueue) {
  122. if (report.type === reportType.ERROR) {
  123. const errorData = report.data;
  124. CallStats._reportError(
  125. defaultInstance,
  126. errorData.type,
  127. errorData.error,
  128. errorData.pc || defaultPC);
  129. } else if (report.type === reportType.EVENT) {
  130. // if we have and event to report and we failed to add
  131. // fabric this event will not be reported anyway, returning
  132. // an error
  133. const eventData = report.data;
  134. CallStats.backend.sendFabricEvent(
  135. report.pc || defaultPC,
  136. eventData.event,
  137. defaultConfID,
  138. eventData.eventData);
  139. } else if (report.type === reportType.MST_WITH_USERID) {
  140. const data = report.data;
  141. CallStats.backend.associateMstWithUserID(
  142. report.pc || defaultPC,
  143. data.callStatsId,
  144. defaultConfID,
  145. data.ssrc,
  146. data.usageLabel,
  147. data.containerId
  148. );
  149. }
  150. }
  151. CallStats.reportsQueue.length = 0;
  152. }
  153. /* eslint-disable max-params */
  154. /**
  155. * Reports an error to callstats.
  156. *
  157. * @param {CallStats} [cs]
  158. * @param type the type of the error, which will be one of the wrtcFuncNames
  159. * @param error the error
  160. * @param pc the peerconnection
  161. * @private
  162. */
  163. static _reportError(cs, type, error, pc) {
  164. let _error = error;
  165. if (!_error) {
  166. logger.warn('No error is passed!');
  167. _error = new Error('Unknown error');
  168. }
  169. if (CallStats.initialized && cs) {
  170. CallStats.backend.reportError(pc, cs.confID, type, _error);
  171. } else {
  172. CallStats.reportsQueue.push({
  173. type: reportType.ERROR,
  174. data: {
  175. error: _error,
  176. pc,
  177. type
  178. }
  179. });
  180. }
  181. // else just ignore it
  182. }
  183. /* eslint-enable max-params */
  184. /**
  185. * Reports an error to callstats.
  186. *
  187. * @param {CallStats} cs
  188. * @param event the type of the event, which will be one of the fabricEvent
  189. * @param eventData additional data to pass to event
  190. * @private
  191. */
  192. static _reportEvent(cs, event, eventData) {
  193. const pc = cs && cs.peerconnection;
  194. const confID = cs && cs.confID;
  195. if (CallStats.initialized && cs) {
  196. CallStats.backend.sendFabricEvent(pc, event, confID, eventData);
  197. } else {
  198. CallStats.reportsQueue.push({
  199. confID,
  200. pc,
  201. type: reportType.EVENT,
  202. data: { event,
  203. eventData }
  204. });
  205. }
  206. }
  207. /**
  208. * Wraps some of the CallStats API method and logs their calls with
  209. * arguments on the debug logging level. Also wraps some of the backend
  210. * methods execution into try catch blocks to not crash the app in case
  211. * there is a problem with the backend itself.
  212. * @param {callstats} theBackend
  213. * @private
  214. */
  215. static _traceAndCatchBackendCalls(theBackend) {
  216. const tryCatchMethods = [
  217. 'associateMstWithUserID',
  218. 'sendFabricEvent',
  219. 'sendUserFeedback'
  220. // 'reportError', - this one needs special handling - see code below
  221. ];
  222. for (const methodName of tryCatchMethods) {
  223. const originalMethod = theBackend[methodName];
  224. theBackend[methodName] = function(...theArguments) {
  225. try {
  226. return originalMethod.apply(theBackend, theArguments);
  227. } catch (e) {
  228. GlobalOnErrorHandler.callErrorHandler(e);
  229. }
  230. };
  231. }
  232. const debugMethods = [
  233. 'associateMstWithUserID',
  234. 'sendFabricEvent',
  235. 'sendUserFeedback'
  236. // 'reportError', - this one needs special handling - see code below
  237. ];
  238. for (const methodName of debugMethods) {
  239. const originalMethod = theBackend[methodName];
  240. theBackend[methodName] = function(...theArguments) {
  241. logger.debug(methodName, theArguments);
  242. originalMethod.apply(theBackend, theArguments);
  243. };
  244. }
  245. const originalReportError = theBackend.reportError;
  246. /* eslint-disable max-params */
  247. theBackend.reportError
  248. = function(pc, cs, type, ...args) {
  249. // Logs from the logger are submitted on the applicationLog event
  250. // "type". Logging the arguments on the logger will create endless
  251. // loop, because it will put all the logs to the logger queue again.
  252. if (type === wrtcFuncNames.applicationLog) {
  253. // NOTE otherArguments are not logged to the console on purpose
  254. // to not log the whole log batch
  255. // FIXME check the current logging level (currently not exposed
  256. // by the logger implementation)
  257. console && console.debug('reportError', pc, cs, type);
  258. } else {
  259. logger.debug('reportError', pc, cs, type, ...args);
  260. }
  261. try {
  262. originalReportError.call(theBackend, pc, cs, type, ...args);
  263. } catch (exception) {
  264. if (type === wrtcFuncNames.applicationLog) {
  265. console && console.error('reportError', exception);
  266. } else {
  267. GlobalOnErrorHandler.callErrorHandler(exception);
  268. }
  269. }
  270. };
  271. /* eslint-enable max-params */
  272. }
  273. /**
  274. * Returns the Set with the currently existing {@link CallStats} instances.
  275. * Lazily initializes the Set to allow any Set polyfills to be applied.
  276. * @type {Set<CallStats>}
  277. */
  278. static get fabrics() {
  279. if (!_fabrics) {
  280. _fabrics = new Set();
  281. }
  282. return _fabrics;
  283. }
  284. /**
  285. * Initializes the CallStats backend. Should be called only if
  286. * {@link CallStats.isBackendInitialized} returns <tt>false</tt>.
  287. * @param {object} options
  288. * @param {String} options.callStatsID CallStats credentials - ID
  289. * @param {String} options.callStatsSecret CallStats credentials - secret
  290. * @param {string} options.aliasName the <tt>aliasName</tt> part of
  291. * the <tt>userID</tt> aka endpoint ID, see CallStats docs for more info.
  292. * @param {string} options.userName the <tt>userName</tt> part of
  293. * the <tt>userID</tt> aka display name, see CallStats docs for more info.
  294. *
  295. */
  296. static initBackend(options) {
  297. if (CallStats.backend) {
  298. throw new Error('CallStats backend has been initialized already!');
  299. }
  300. try {
  301. // eslint-disable-next-line new-cap
  302. CallStats.backend = new callstats();
  303. CallStats._traceAndCatchBackendCalls(CallStats.backend);
  304. CallStats.userID = {
  305. aliasName: options.aliasName,
  306. userName: options.userName
  307. };
  308. CallStats.callStatsID = options.callStatsID;
  309. CallStats.callStatsSecret = options.callStatsSecret;
  310. // userID is generated or given by the origin server
  311. CallStats.backend.initialize(
  312. CallStats.callStatsID,
  313. CallStats.callStatsSecret,
  314. CallStats.userID,
  315. CallStats._initCallback);
  316. return true;
  317. } catch (e) {
  318. // The callstats.io API failed to initialize (e.g. because its
  319. // download did not succeed in general or on time). Further attempts
  320. // to utilize it cannot possibly succeed.
  321. GlobalOnErrorHandler.callErrorHandler(e);
  322. CallStats.backend = null;
  323. logger.error(e);
  324. return false;
  325. }
  326. }
  327. /**
  328. * Checks if the CallStats backend has been created. It does not mean that
  329. * it has been initialized, but only that the API instance has been
  330. * allocated successfully.
  331. * @return {boolean} <tt>true</tt> if backend exists or <tt>false</tt>
  332. * otherwise
  333. */
  334. static isBackendInitialized() {
  335. return Boolean(CallStats.backend);
  336. }
  337. /**
  338. * Notifies CallStats about active device.
  339. * @param {{deviceList: {String:String}}} devicesData list of devices with
  340. * their data
  341. * @param {CallStats} cs callstats instance related to the event
  342. */
  343. static sendActiveDeviceListEvent(devicesData, cs) {
  344. CallStats._reportEvent(cs, fabricEvent.activeDeviceList, devicesData);
  345. }
  346. /**
  347. * Notifies CallStats that there is a log we want to report.
  348. *
  349. * @param {Error} e error to send or {String} message
  350. * @param {CallStats} cs callstats instance related to the error (optional)
  351. */
  352. static sendApplicationLog(e, cs) {
  353. try {
  354. CallStats._reportError(
  355. cs,
  356. wrtcFuncNames.applicationLog,
  357. e,
  358. cs && cs.peerconnection);
  359. } catch (error) {
  360. // If sendApplicationLog fails it should not be printed to
  361. // the logger, because it will try to push the logs again
  362. // (through sendApplicationLog) and an endless loop is created.
  363. if (console && (typeof console.error === 'function')) {
  364. // FIXME send analytics event as well
  365. console.error('sendApplicationLog failed', error);
  366. }
  367. }
  368. }
  369. /**
  370. * Sends the given feedback through CallStats.
  371. *
  372. * @param {string} conferenceID the conference ID for which the feedback
  373. * will be reported.
  374. * @param overallFeedback an integer between 1 and 5 indicating the
  375. * user feedback
  376. * @param detailedFeedback detailed feedback from the user. Not yet used
  377. */
  378. static sendFeedback(conferenceID, overallFeedback, detailedFeedback) {
  379. if (CallStats.backend) {
  380. CallStats.backend.sendUserFeedback(
  381. conferenceID, {
  382. userID: CallStats.userID,
  383. overall: overallFeedback,
  384. comment: detailedFeedback
  385. });
  386. } else {
  387. logger.error('Failed to submit feedback to CallStats - no backend');
  388. }
  389. }
  390. /**
  391. * Notifies CallStats that getUserMedia failed.
  392. *
  393. * @param {Error} e error to send
  394. * @param {CallStats} cs callstats instance related to the error (optional)
  395. */
  396. static sendGetUserMediaFailed(e, cs) {
  397. CallStats._reportError(cs, wrtcFuncNames.getUserMedia, e, null);
  398. }
  399. /**
  400. * Notifies CallStats for mute events
  401. * @param mute {boolean} true for muted and false for not muted
  402. * @param type {String} "audio"/"video"
  403. * @param {CallStats} cs callstats instance related to the event
  404. */
  405. static sendMuteEvent(mute, type, cs) {
  406. let event;
  407. if (type === 'video') {
  408. event = mute ? fabricEvent.videoPause : fabricEvent.videoResume;
  409. } else {
  410. event = mute ? fabricEvent.audioMute : fabricEvent.audioUnmute;
  411. }
  412. CallStats._reportEvent(cs, event);
  413. }
  414. /**
  415. * Creates new CallStats instance that handles all callstats API calls for
  416. * given {@link TraceablePeerConnection}. Each instance is meant to handle
  417. * one CallStats fabric added with 'addFabric' API method for the
  418. * {@link TraceablePeerConnection} instance passed in the constructor.
  419. * @param {TraceablePeerConnection} tpc
  420. * @param {Object} options
  421. * @param {string} options.confID the conference ID that wil be used to
  422. * report the session.
  423. * @param {string} [options.remoteUserID='jitsi'] the remote user ID to
  424. * which given <tt>tpc</tt> is connected.
  425. */
  426. constructor(tpc, options) {
  427. if (!CallStats.backend) {
  428. throw new Error('CallStats backend not intiialized!');
  429. }
  430. this.confID = options.confID;
  431. this.tpc = tpc;
  432. this.peerconnection = tpc.peerconnection;
  433. this.remoteUserID = options.remoteUserID || DEFAULT_REMOTE_USER;
  434. this.hasFabric = false;
  435. CallStats.fabrics.add(this);
  436. if (CallStats.initialized) {
  437. this._addNewFabric();
  438. }
  439. }
  440. /**
  441. * Initializes CallStats fabric by calling "addNewFabric" for
  442. * the peer connection associated with this instance.
  443. * @return {boolean} true if the call was successful or false otherwise.
  444. */
  445. _addNewFabric() {
  446. logger.info('addNewFabric', this.remoteUserID, this);
  447. try {
  448. const ret
  449. = CallStats.backend.addNewFabric(
  450. this.peerconnection,
  451. this.remoteUserID,
  452. CallStats.backend.fabricUsage.multiplex,
  453. this.confID,
  454. CallStats._addNewFabricCallback);
  455. this.hasFabric = true;
  456. const success = ret.status === 'success';
  457. if (!success) {
  458. logger.error('callstats fabric not initilized', ret.message);
  459. }
  460. return success;
  461. } catch (error) {
  462. GlobalOnErrorHandler.callErrorHandler(error);
  463. return false;
  464. }
  465. }
  466. /* eslint-disable max-params */
  467. /**
  468. * Lets CallStats module know where is given SSRC rendered by providing
  469. * renderer tag ID.
  470. * If the lib is not initialized yet queue the call for later, when it's
  471. * ready.
  472. * @param {number} ssrc the SSRC of the stream
  473. * @param {boolean} isLocal indicates whether this the stream is local
  474. * @param {string|null} streamEndpointId if the stream is not local the it
  475. * needs to contain the stream owner's ID
  476. * @param {string} usageLabel meaningful usage label of this stream like
  477. * 'microphone', 'camera' or 'screen'.
  478. * @param {string} containerId the id of media 'audio' or 'video' tag which
  479. * renders the stream.
  480. */
  481. associateStreamWithVideoTag(
  482. ssrc,
  483. isLocal,
  484. streamEndpointId,
  485. usageLabel,
  486. containerId) {
  487. if (!CallStats.backend) {
  488. return;
  489. }
  490. const callStatsId = isLocal ? CallStats.userID : streamEndpointId;
  491. if (CallStats.initialized) {
  492. CallStats.backend.associateMstWithUserID(
  493. this.peerconnection,
  494. callStatsId,
  495. this.confID,
  496. ssrc,
  497. usageLabel,
  498. containerId);
  499. } else {
  500. CallStats.reportsQueue.push({
  501. type: reportType.MST_WITH_USERID,
  502. pc: this.peerconnection,
  503. data: {
  504. callStatsId,
  505. containerId,
  506. ssrc,
  507. usageLabel
  508. }
  509. });
  510. }
  511. }
  512. /* eslint-enable max-params */
  513. /**
  514. * Notifies CallStats that we are the new dominant speaker in the
  515. * conference.
  516. */
  517. sendDominantSpeakerEvent() {
  518. CallStats._reportEvent(this, fabricEvent.dominantSpeaker);
  519. }
  520. /**
  521. * Notifies CallStats that the fabric for the underlying peerconnection was
  522. * closed and no evens should be reported, after this call.
  523. */
  524. sendTerminateEvent() {
  525. if (CallStats.initialized) {
  526. CallStats.backend.sendFabricEvent(
  527. this.peerconnection,
  528. CallStats.backend.fabricEvent.fabricTerminated,
  529. this.confID);
  530. }
  531. CallStats.fabrics.delete(this);
  532. }
  533. /**
  534. * Notifies CallStats for ice connection failed
  535. */
  536. sendIceConnectionFailedEvent() {
  537. CallStats._reportError(
  538. this,
  539. wrtcFuncNames.iceConnectionFailure,
  540. null,
  541. this.peerconnection);
  542. }
  543. /**
  544. * Notifies CallStats that peer connection failed to create offer.
  545. *
  546. * @param {Error} e error to send
  547. */
  548. sendCreateOfferFailed(e) {
  549. CallStats._reportError(
  550. this, wrtcFuncNames.createOffer, e, this.peerconnection);
  551. }
  552. /**
  553. * Notifies CallStats that peer connection failed to create answer.
  554. *
  555. * @param {Error} e error to send
  556. */
  557. sendCreateAnswerFailed(e) {
  558. CallStats._reportError(
  559. this, wrtcFuncNames.createAnswer, e, this.peerconnection);
  560. }
  561. /**
  562. * Sends either resume or hold event for the fabric associated with
  563. * the underlying peerconnection.
  564. * @param {boolean} isResume true to resume or false to hold
  565. */
  566. sendResumeOrHoldEvent(isResume) {
  567. CallStats._reportEvent(
  568. this,
  569. isResume ? fabricEvent.fabricResume : fabricEvent.fabricHold);
  570. }
  571. /**
  572. * Notifies CallStats for screen sharing events
  573. * @param {boolean} start true for starting screen sharing and
  574. * false for not stopping
  575. */
  576. sendScreenSharingEvent(start) {
  577. CallStats._reportEvent(
  578. this,
  579. start ? fabricEvent.screenShareStart : fabricEvent.screenShareStop);
  580. }
  581. /**
  582. * Notifies CallStats that peer connection failed to set local description.
  583. *
  584. * @param {Error} e error to send
  585. */
  586. sendSetLocalDescFailed(e) {
  587. CallStats._reportError(
  588. this, wrtcFuncNames.setLocalDescription, e, this.peerconnection);
  589. }
  590. /**
  591. * Notifies CallStats that peer connection failed to set remote description.
  592. *
  593. * @param {Error} e error to send
  594. */
  595. sendSetRemoteDescFailed(e) {
  596. CallStats._reportError(
  597. this, wrtcFuncNames.setRemoteDescription, e, this.peerconnection);
  598. }
  599. /**
  600. * Notifies CallStats that peer connection failed to add ICE candidate.
  601. *
  602. * @param {Error} e error to send
  603. */
  604. sendAddIceCandidateFailed(e) {
  605. CallStats._reportError(
  606. this, wrtcFuncNames.addIceCandidate, e, this.peerconnection);
  607. }
  608. }
  609. /**
  610. * The CallStats API backend instance
  611. * @type {callstats}
  612. */
  613. CallStats.backend = null;
  614. // some errors/events may happen before CallStats init
  615. // in this case we accumulate them in this array
  616. // and send them to callstats on init
  617. CallStats.reportsQueue = [];
  618. /**
  619. * Whether the library was successfully initialized using its initialize method.
  620. * And whether we had successfully called addNewFabric at least once.
  621. * @type {boolean}
  622. */
  623. CallStats.initialized = false;
  624. /**
  625. * Part of the CallStats credentials - application ID
  626. * @type {string}
  627. */
  628. CallStats.callStatsID = null;
  629. /**
  630. * Part of the CallStats credentials - application secret
  631. * @type {string}
  632. */
  633. CallStats.callStatsSecret = null;
  634. /**
  635. * Local CallStats user ID structure. Can be set only once when
  636. * {@link backend} is initialized, so it's static for the time being.
  637. * See CallStats API for more info:
  638. * https://www.callstats.io/api/#userid
  639. * @type {object}
  640. */
  641. CallStats.userID = null;