Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

CallStats.js 23KB

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