@@ -54154,9 +54154,14 @@ WebRTCSession.prototype._createPeer = function (userId, polite) {
5415454154
5415554155 this.startCallTime = new Date();
5415654156
54157- var pcConfig = {
54158- iceServers: config.webrtc.iceServers,
54159- };
54157+ // var pcConfig = {
54158+ // iceServers: config.webrtc.iceServers,
54159+ // };
54160+ const base = { iceServers: config.webrtc.iceServers };
54161+ const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
54162+ : { iceTransportPolicy: config.webrtc.iceTransportPolicy };
54163+
54164+ const pcConfig = Object.assign({}, base, extra);
5416054165
5416154166 Helpers.trace("_createPeer configuration: " + JSON.stringify(pcConfig));
5416254167
@@ -54321,9 +54326,14 @@ WebRTCSession.prototype._reconnect = function (peerConnection, negotiate) {
5432154326
5432254327 peerConnection.release();
5432354328
54324- var pcConfig = {
54325- iceServers: config.webrtc.iceServers,
54326- };
54329+ // var pcConfig = {
54330+ // iceServers: config.webrtc.iceServers,
54331+ // };
54332+ const base = { iceServers: config.webrtc.iceServers };
54333+ const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
54334+ : { iceTransportPolicy: config.webrtc.iceTransportPolicy };
54335+
54336+ const pcConfig = Object.assign({}, base, extra);
5432754337
5432854338 Helpers.trace("_reconnect peer configuration: " + JSON.stringify(pcConfig));
5432954339
@@ -54571,7 +54581,26 @@ module.exports = WebRTCSignalingConstants;
5457154581 * WebRTC Module (WebRTC signaling provider)
5457254582 */
5457354583
54574- require('strophe.js');
54584+ // require('strophe.js');
54585+ // Try to load the UMD build that works with Node/CommonJS
54586+ var __stropheMod;
54587+ try {
54588+ __stropheMod = require('strophe.js/dist/strophe.umd.js');
54589+ } catch (e) {
54590+ // Fallback: load default entry if the path above is not available
54591+ __stropheMod = require('strophe.js');
54592+ }
54593+
54594+ // Normalize possible export shapes
54595+ // Strophe can be exported as { Strophe }, default, or the module itself
54596+ var Strophe =
54597+ (__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
54598+
54599+ // Basic guard: make sure the Connection class exists
54600+ if (!Strophe || !Strophe.Connection) {
54601+ throw new Error('[QBChat] Strophe import failed: Connection class not found');
54602+ }
54603+ // ---------------------------------------------------------------------------
5457554604
5457654605var SignalingConstants = require('./qbWebRTCSignalingConstants');
5457754606
@@ -54721,7 +54750,7 @@ function WebRTCSignalingProcessor(service, delegate) {
5472154750
5472254751module.exports = WebRTCSignalingProcessor;
5472354752
54724- },{"./qbWebRTCSignalingConstants":251,"strophe.js":211}],253:[function(require,module,exports){
54753+ },{"./qbWebRTCSignalingConstants":251,"strophe.js":211,"strophe.js/dist/strophe.umd.js":211 }],253:[function(require,module,exports){
5472554754'use strict';
5472654755
5472754756/** JSHint inline rules */
@@ -54732,7 +54761,26 @@ module.exports = WebRTCSignalingProcessor;
5473254761 * WebRTC Module (WebRTC signaling processor)
5473354762 */
5473454763
54735- require('strophe.js');
54764+ // require('strophe.js');
54765+ // Try to load the UMD build that works with Node/CommonJS
54766+ var __stropheMod;
54767+ try {
54768+ __stropheMod = require('strophe.js/dist/strophe.umd.js');
54769+ } catch (e) {
54770+ // Fallback: load default entry if the path above is not available
54771+ __stropheMod = require('strophe.js');
54772+ }
54773+
54774+ // Normalize possible export shapes
54775+ // Strophe can be exported as { Strophe }, default, or the module itself
54776+ var Strophe =
54777+ (__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
54778+
54779+ // Basic guard: make sure the Connection class exists
54780+ if (!Strophe || !Strophe.Connection) {
54781+ throw new Error('[QBChat] Strophe import failed: Connection class not found');
54782+ }
54783+ // ---------------------------------------------------------------------------
5473654784
5473754785var Helpers = require('./qbWebRTCHelpers');
5473854786var SignalingConstants = require('./qbWebRTCSignalingConstants');
@@ -54828,7 +54876,7 @@ WebRTCSignalingProvider.prototype._JStoXML = function (title, obj, msg) {
5482854876
5482954877module.exports = WebRTCSignalingProvider;
5483054878
54831- },{"../../qbConfig":255,"../../qbUtils":259,"./qbWebRTCHelpers":249,"./qbWebRTCSignalingConstants":251,"strophe.js":211}],254:[function(require,module,exports){
54879+ },{"../../qbConfig":255,"../../qbUtils":259,"./qbWebRTCHelpers":249,"./qbWebRTCSignalingConstants":251,"strophe.js":211,"strophe.js/dist/strophe.umd.js":211 }],254:[function(require,module,exports){
5483254880'use strict';
5483354881
5483454882/**
@@ -55080,8 +55128,8 @@ module.exports = StreamManagement;
5508055128 */
5508155129
5508255130var config = {
55083- version: '2.21.0 ',
55084- buildNumber: '1167 ',
55131+ version: '2.21.3 ',
55132+ buildNumber: '1169 ',
5508555133 creds: {
5508655134 'appId': 0,
5508755135 'authKey': '',
@@ -55115,6 +55163,12 @@ var config = {
5511555163 dialingTimeInterval: 5,
5511655164 disconnectTimeInterval: 30,
5511755165 statsReportTimeInterval: false,
55166+ /**
55167+ * ICE transport policy.
55168+ * If undefined -> do not pass this option into RTCPeerConnection.
55169+ * Allowed values when set: "all" | "relay".
55170+ */
55171+ iceTransportPolicy: undefined,
5511855172 iceServers: [
5511955173 {
5512055174 urls: ['turn:turn.quickblox.com', 'stun:turn.quickblox.com'],
@@ -55153,33 +55207,49 @@ var config = {
5515355207 callBackInterval: 30,
5515455208};
5515555209
55156- config.set = function(options) {
55157- if (typeof options.endpoints === 'object' && options.endpoints.chat) {
55158- config.endpoints.muc = 'muc.'+options.endpoints.chat;
55159- config.chatProtocol.bosh = 'https://'+options.endpoints.chat+':5281';
55160- config.chatProtocol.websocket = 'wss://'+options.endpoints.chat+':5291';
55161- }
55162-
55163- Object.keys(options).forEach(function(key) {
55164- if(key !== 'set' && config.hasOwnProperty(key)) {
55165- if(typeof options[key] !== 'object') {
55166- config[key] = options[key];
55167- } else {
55168- Object.keys(options[key]).forEach(function(nextkey) {
55169- if(config[key].hasOwnProperty(nextkey)){
55170- config[key][nextkey] = options[key][nextkey];
55171- }
55172- });
55173- }
55210+ config.set = function (options) {
55211+ // Update chat endpoints (same behavior as before)
55212+ if (typeof options.endpoints === 'object' && options.endpoints.chat) {
55213+ config.endpoints.muc = 'muc.' + options.endpoints.chat;
55214+ config.chatProtocol.bosh = 'https://' + options.endpoints.chat + ':5281';
55215+ config.chatProtocol.websocket = 'wss://' + options.endpoints.chat + ':5291';
5517455216 }
5517555217
55176- // backward compatibility: for config.iceServers
55177- if(key === 'iceServers') {
55178- config.webrtc.iceServers = options[key];
55179- }
55180- });
55218+ // Shallow merge: copy only known keys; skip undefined values
55219+ Object.keys(options).forEach(function (key) {
55220+ if (key !== 'set' && Object.prototype.hasOwnProperty.call(config, key)) {
55221+ if (typeof options[key] !== 'object' || options[key] === null) {
55222+ // Primitive or null: assign as is
55223+ if (typeof options[key] !== 'undefined') {
55224+ config[key] = options[key];
55225+ }
55226+ } else {
55227+ // Object: copy only known subkeys; skip undefined values
55228+ Object.keys(options[key]).forEach(function (nextkey) {
55229+ if (
55230+ Object.prototype.hasOwnProperty.call(config[key], nextkey) &&
55231+ typeof options[key][nextkey] !== 'undefined'
55232+ ) {
55233+ config[key][nextkey] = options[key][nextkey];
55234+ }
55235+ });
55236+ }
55237+ }
55238+
55239+ // Backward compatibility: allow top-level iceServers
55240+ if (key === 'iceServers' && typeof options[key] !== 'undefined') {
55241+ config.webrtc.iceServers = options[key];
55242+ }
55243+
55244+ // Backward compatibility: allow top-level iceTransportPolicy
55245+ if (key === 'iceTransportPolicy' && typeof options[key] !== 'undefined') {
55246+ // Allowed values when set: "all" | "relay"
55247+ config.webrtc.iceTransportPolicy = options[key];
55248+ }
55249+ });
5518155250};
5518255251
55252+
5518355253config.updateSessionExpirationDate = function (tokenExpirationDate, headerHasToken = false) {
5518455254 var connectionTimeLag = 1; // minute
5518555255 var newDate;
@@ -55210,11 +55280,11 @@ module.exports = config;
5521055280 */
5521155281var config = require('./qbConfig');
5521255282var Utils = require('./qbUtils');
55213- const MessageProxy = require("./modules/chat/qbMessage");
55214- const Chat = require("./modules/chat/qbChat");
55215- const DialogProxy = require("./modules/chat/qbDialog");
55216- const WebRTCClient = require("./modules/webrtc/qbWebRTCClient");
55217- const PushNotifications = require("./modules/qbPushNotifications");
55283+ // const MessageProxy = require("./modules/chat/qbMessage");
55284+ // const Chat = require("./modules/chat/qbChat");
55285+ // const DialogProxy = require("./modules/chat/qbDialog");
55286+ // const WebRTCClient = require("./modules/webrtc/qbWebRTCClient");
55287+ // const PushNotifications = require("./modules/qbPushNotifications");
5521855288
5521955289// Actual QuickBlox API starts here
5522055290function QuickBlox() {}
@@ -55970,12 +56040,36 @@ module.exports = ServiceProxy;
5597056040 * Strophe Connection Object
5597156041 */
5597256042
55973- require('strophe.js');
56043+ // require('strophe.js');
56044+
56045+ // ---- Strophe import (UMD-first with safe fallback) -------------------------
56046+ // Try to load the UMD build that works with Node/CommonJS
56047+ var __stropheMod;
56048+ try {
56049+ __stropheMod = require('strophe.js/dist/strophe.umd.js');
56050+ } catch (e) {
56051+ // Fallback: load default entry if the path above is not available
56052+ __stropheMod = require('strophe.js');
56053+ }
56054+
56055+ // Normalize possible export shapes
56056+ // Strophe can be exported as { Strophe }, default, or the module itself
56057+ var Strophe =
56058+ (__stropheMod && (__stropheMod.Strophe || __stropheMod.default || __stropheMod)) || undefined;
56059+
56060+ // Basic guard: make sure the Connection class exists
56061+ if (!Strophe || !Strophe.Connection) {
56062+ throw new Error('[QBChat] Strophe import failed: Connection class not found');
56063+ }
56064+ // ---------------------------------------------------------------------------
5597456065
5597556066var config = require('./qbConfig');
5597656067var chatPRTCL = config.chatProtocol;
5597756068var Utils = require('./qbUtils');
5597856069
56070+
56071+
56072+
5597956073function Connection(onLogListenerCallback) {
5598056074 var protocol = chatPRTCL.active === 1 ? chatPRTCL.bosh : chatPRTCL.websocket;
5598156075 var conn = new Strophe.Connection(protocol);
@@ -56039,7 +56133,7 @@ function Connection(onLogListenerCallback) {
5603956133
5604056134module.exports = Connection;
5604156135
56042- },{"./qbConfig":255,"./qbUtils":259,"strophe.js":211}],259:[function(require,module,exports){
56136+ },{"./qbConfig":255,"./qbUtils":259,"strophe.js":211,"strophe.js/dist/strophe.umd.js":211 }],259:[function(require,module,exports){
5604356137(function (global){(function (){
5604456138/* eslint no-console: 2 */
5604556139
0 commit comments