@flashphoner/websdk 2.0.277 → 2.0.281

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashphoner/websdk",
3
- "version": "2.0.277",
3
+ "version": "2.0.281",
4
4
  "description": "Official Flashphoner WebCallServer WebSDK package",
5
5
  "main": "./src/flashphoner-core.js",
6
6
  "types": "./src/flashphoner-core.d.ts",
@@ -802,3 +802,16 @@ export const CONTENT_HINT_TYPE: Readonly<{
802
802
  */
803
803
  TEXT: string;
804
804
  }>;
805
+
806
+ /**
807
+ * Server information constants
808
+ * @namespace Flashphoner.constants.SERVER_INFO
809
+ */
810
+ export const SERVER_INFO: Readonly<{
811
+ /**
812
+ * The version of the WCS that the current session is connected to
813
+ * @see Session
814
+ * @memberOf Flashphoner.constants.SERVER_INFO
815
+ */
816
+ SERVER_VERSION: string;
817
+ }>;
package/src/constants.js CHANGED
@@ -842,6 +842,19 @@ const CONTENT_HINT_TYPE = Object.freeze({
842
842
  TEXT: 'text'
843
843
  });
844
844
 
845
+ /**
846
+ * Server information constants
847
+ * @namespace Flashphoner.constants.SERVER_INFO
848
+ */
849
+ const SERVER_INFO = Object.freeze({
850
+ /**
851
+ * The version of the WCS that the current session is connected to
852
+ * @see Session
853
+ * @memberOf Flashphoner.constants.SERVER_INFO
854
+ */
855
+ SERVER_VERSION: 'serverVersion'
856
+ });
857
+
845
858
  module.exports = {
846
859
  SESSION_STATUS,
847
860
  STREAM_STATUS,
@@ -854,5 +867,6 @@ module.exports = {
854
867
  CONNECTION_QUALITY,
855
868
  STREAM_EVENT,
856
869
  STREAM_EVENT_TYPE,
857
- CONTENT_HINT_TYPE
870
+ CONTENT_HINT_TYPE,
871
+ SERVER_INFO
858
872
  };
@@ -22,6 +22,7 @@ var clientUAData;
22
22
  */
23
23
 
24
24
  const SESSION_STATUS = constants.SESSION_STATUS;
25
+ const SERVER_INFO = constants.SERVER_INFO;
25
26
  const STREAM_EVENT = constants.STREAM_EVENT;
26
27
  const STREAM_EVENT_TYPE = constants.STREAM_EVENT_TYPE;
27
28
  const STREAM_STATUS = constants.STREAM_STATUS;
@@ -511,6 +512,7 @@ var createSession = function (options) {
511
512
  var wsPingSender = new WSPingSender(options.pingInterval || 0);
512
513
  var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
513
514
  var connectionTimeout;
515
+ var serverVersion;
514
516
 
515
517
  var cConfig;
516
518
  //SIP config
@@ -660,6 +662,11 @@ var createSession = function (options) {
660
662
  webRTCMetricsServerDescription = obj.webRTCMetricsServerDescription;
661
663
  onSessionStatusChange(SESSION_STATUS.ESTABLISHED, obj);
662
664
  break;
665
+ case 'getVersion':
666
+ serverVersion = obj;
667
+ logger.info(LOG_PREFIX, "server version: " + serverVersion);
668
+ callbacks[SERVER_INFO.SERVER_VERSION](session);
669
+ break;
663
670
  case 'setRemoteSDP':
664
671
  var mediaSessionId = data.data[0];
665
672
  var sdp = data.data[1];
@@ -2944,6 +2951,17 @@ var createSession = function (options) {
2944
2951
  return sessionStatus;
2945
2952
  };
2946
2953
 
2954
+ /**
2955
+ * Get server version
2956
+ *
2957
+ * @returns {string} serverVersion Server version
2958
+ * @memberof Session
2959
+ * @inner
2960
+ */
2961
+ var getServerVersion = function () {
2962
+ return serverVersion;
2963
+ };
2964
+
2947
2965
  /**
2948
2966
  * Get stream by id.
2949
2967
  *
@@ -3188,6 +3206,7 @@ var createSession = function (options) {
3188
3206
  session.stopDebug = stopDebug;
3189
3207
  session.on = on;
3190
3208
  session.getLogger = getLogger;
3209
+ session.getServerVersion = getServerVersion;
3191
3210
 
3192
3211
  //save interface to global map
3193
3212
  sessions[id_] = session;