modified lib-jitsi-meet dev repo
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.

ChatRoom.js 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. var logger = require("jitsi-meet-logger").getLogger(__filename);
  2. var XMPPEvents = require("../../service/xmpp/XMPPEvents");
  3. var Moderator = require("./moderator");
  4. var EventEmitter = require("events");
  5. var parser = {
  6. packet2JSON: function (packet, nodes) {
  7. var self = this;
  8. $(packet).children().each(function (index) {
  9. var tagName = $(this).prop("tagName");
  10. var node = {}
  11. node["tagName"] = tagName;
  12. node.attributes = {};
  13. $($(this)[0].attributes).each(function( index, attr ) {
  14. node.attributes[ attr.name ] = attr.value;
  15. } );
  16. var text = Strophe.getText($(this)[0]);
  17. if(text)
  18. node.value = text;
  19. node.children = [];
  20. nodes.push(node);
  21. self.packet2JSON($(this), node.children);
  22. })
  23. },
  24. JSON2packet: function (nodes, packet) {
  25. for(var i = 0; i < nodes.length; i++)
  26. {
  27. var node = nodes[i];
  28. if(!node || node === null){
  29. continue;
  30. }
  31. packet.c(node.tagName, node.attributes);
  32. if(node.value)
  33. packet.t(node.value);
  34. if(node.children)
  35. this.JSON2packet(node.children, packet);
  36. packet.up();
  37. }
  38. // packet.up();
  39. }
  40. };
  41. /**
  42. * Returns array of JS objects from the presence JSON associated with the passed nodeName
  43. * @param pres the presence JSON
  44. * @param nodeName the name of the node (videomuted, audiomuted, etc)
  45. */
  46. function filterNodeFromPresenceJSON(pres, nodeName){
  47. var res = [];
  48. for(var i = 0; i < pres.length; i++)
  49. if(pres[i].tagName === nodeName)
  50. res.push(pres[i]);
  51. return res;
  52. }
  53. function ChatRoom(connection, jid, password, XMPP, options) {
  54. this.eventEmitter = new EventEmitter();
  55. this.xmpp = XMPP;
  56. this.connection = connection;
  57. this.roomjid = Strophe.getBareJidFromJid(jid);
  58. this.myroomjid = jid;
  59. this.password = password;
  60. logger.info("Joined MUC as " + this.myroomjid);
  61. this.members = {};
  62. this.presMap = {};
  63. this.presHandlers = {};
  64. this.joined = false;
  65. this.role = null;
  66. this.focusMucJid = null;
  67. this.bridgeIsDown = false;
  68. this.options = options || {};
  69. this.moderator = new Moderator(this.roomjid, this.xmpp, this.eventEmitter);
  70. this.initPresenceMap();
  71. this.session = null;
  72. var self = this;
  73. this.lastPresences = {};
  74. }
  75. ChatRoom.prototype.initPresenceMap = function () {
  76. this.presMap['to'] = this.myroomjid;
  77. this.presMap['xns'] = 'http://jabber.org/protocol/muc';
  78. this.presMap["nodes"] = [];
  79. this.presMap["nodes"].push( {
  80. "tagName": "user-agent",
  81. "value": navigator.userAgent,
  82. "attributes": {xmlns: 'http://jitsi.org/jitmeet/user-agent'}
  83. });
  84. };
  85. ChatRoom.prototype.updateDeviceAvailability = function (devices) {
  86. this.presMap["nodes"].push( {
  87. "tagName": "devices",
  88. "children": [
  89. {
  90. "tagName": "audio",
  91. "value": devices.audio,
  92. },
  93. {
  94. "tagName": "video",
  95. "value": devices.video,
  96. }
  97. ]
  98. });
  99. }
  100. ChatRoom.prototype.join = function (password, tokenPassword) {
  101. if(password)
  102. this.password = password;
  103. var self = this;
  104. this.moderator.allocateConferenceFocus(function()
  105. {
  106. self.sendPresence(tokenPassword);
  107. }.bind(this));
  108. };
  109. ChatRoom.prototype.sendPresence = function (tokenPassword) {
  110. if (!this.presMap['to']) {
  111. // Too early to send presence - not initialized
  112. return;
  113. }
  114. var pres = $pres({to: this.presMap['to'] });
  115. pres.c('x', {xmlns: this.presMap['xns']});
  116. if (this.password) {
  117. pres.c('password').t(this.password).up();
  118. }
  119. pres.up();
  120. // Send XEP-0115 'c' stanza that contains our capabilities info
  121. if (this.connection.caps) {
  122. this.connection.caps.node = this.xmpp.options.clientNode;
  123. pres.c('c', this.connection.caps.generateCapsAttrs()).up();
  124. }
  125. if (tokenPassword) {
  126. pres.c('token', { xmlns: 'http://jitsi.org/jitmeet/auth-token'})
  127. .t(tokenPassword).up();
  128. }
  129. parser.JSON2packet(this.presMap.nodes, pres);
  130. this.connection.send(pres);
  131. };
  132. ChatRoom.prototype.doLeave = function () {
  133. logger.log("do leave", this.myroomjid);
  134. var pres = $pres({to: this.myroomjid, type: 'unavailable' });
  135. this.presMap.length = 0;
  136. this.connection.send(pres);
  137. };
  138. ChatRoom.prototype.createNonAnonymousRoom = function () {
  139. // http://xmpp.org/extensions/xep-0045.html#createroom-reserved
  140. var getForm = $iq({type: 'get', to: this.roomjid})
  141. .c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'})
  142. .c('x', {xmlns: 'jabber:x:data', type: 'submit'});
  143. var self = this;
  144. this.connection.sendIQ(getForm, function (form) {
  145. if (!$(form).find(
  146. '>query>x[xmlns="jabber:x:data"]' +
  147. '>field[var="muc#roomconfig_whois"]').length) {
  148. logger.error('non-anonymous rooms not supported');
  149. return;
  150. }
  151. var formSubmit = $iq({to: this.roomjid, type: 'set'})
  152. .c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'});
  153. formSubmit.c('x', {xmlns: 'jabber:x:data', type: 'submit'});
  154. formSubmit.c('field', {'var': 'FORM_TYPE'})
  155. .c('value')
  156. .t('http://jabber.org/protocol/muc#roomconfig').up().up();
  157. formSubmit.c('field', {'var': 'muc#roomconfig_whois'})
  158. .c('value').t('anyone').up().up();
  159. self.connection.sendIQ(formSubmit);
  160. }, function (error) {
  161. logger.error("Error getting room configuration form");
  162. });
  163. };
  164. ChatRoom.prototype.onPresence = function (pres) {
  165. var from = pres.getAttribute('from');
  166. // Parse roles.
  167. var member = {};
  168. member.show = $(pres).find('>show').text();
  169. member.status = $(pres).find('>status').text();
  170. var tmp = $(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>item');
  171. member.affiliation = tmp.attr('affiliation');
  172. member.role = tmp.attr('role');
  173. // Focus recognition
  174. member.jid = tmp.attr('jid');
  175. member.isFocus = false;
  176. if (member.jid
  177. && member.jid.indexOf(this.moderator.getFocusUserJid() + "/") == 0) {
  178. member.isFocus = true;
  179. }
  180. $(pres).find(">x").remove();
  181. var nodes = [];
  182. parser.packet2JSON(pres, nodes);
  183. this.lastPresences[from] = nodes;
  184. for(var i = 0; i < nodes.length; i++)
  185. {
  186. var node = nodes[i];
  187. switch(node.tagName)
  188. {
  189. case "nick":
  190. member.nick = node.value;
  191. if(!member.isFocus) {
  192. var displayName = !this.xmpp.options.displayJids
  193. ? member.nick : Strophe.getResourceFromJid(from);
  194. if (displayName && displayName.length > 0) {
  195. this.eventEmitter.emit(XMPPEvents.DISPLAY_NAME_CHANGED, from, displayName);
  196. }
  197. logger.info("Display name: " + displayName, pres);
  198. }
  199. break;
  200. case "userId":
  201. member.id = node.value;
  202. break;
  203. case "email":
  204. member.email = node.value;
  205. break;
  206. case "bridgeIsDown":
  207. if(!this.bridgeIsDown) {
  208. this.bridgeIsDown = true;
  209. this.eventEmitter.emit(XMPPEvents.BRIDGE_DOWN);
  210. }
  211. break;
  212. default :
  213. this.processNode(node, from);
  214. }
  215. }
  216. if (from == this.myroomjid) {
  217. if (member.affiliation == 'owner')
  218. if (this.role !== member.role) {
  219. this.role = member.role;
  220. this.eventEmitter.emit(XMPPEvents.LOCAL_ROLE_CHANGED,
  221. member, this.isModerator());
  222. }
  223. if (!this.joined) {
  224. this.joined = true;
  225. this.eventEmitter.emit(XMPPEvents.MUC_JOINED, from, member);
  226. }
  227. } else if (this.members[from] === undefined) {
  228. // new participant
  229. this.members[from] = member;
  230. logger.log('entered', from, member);
  231. if (member.isFocus) {
  232. this.focusMucJid = from;
  233. logger.info("Ignore focus: " + from + ", real JID: " + member.jid);
  234. }
  235. else {
  236. this.eventEmitter.emit(XMPPEvents.MUC_MEMBER_JOINED, from, member.id || member.email, member.nick);
  237. }
  238. } else {
  239. // Presence update for existing participant
  240. // Watch role change:
  241. if (this.members[from].role != member.role) {
  242. this.members[from].role = member.role;
  243. this.eventEmitter.emit(XMPPEvents.MUC_ROLE_CHANGED,
  244. member.role, member.nick);
  245. }
  246. }
  247. if(!member.isFocus)
  248. this.eventEmitter.emit(XMPPEvents.USER_ID_CHANGED, from, member.id || member.email);
  249. // Trigger status message update
  250. if (member.status) {
  251. this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member);
  252. }
  253. };
  254. ChatRoom.prototype.processNode = function (node, from) {
  255. if(this.presHandlers[node.tagName])
  256. this.presHandlers[node.tagName](node, from);
  257. };
  258. ChatRoom.prototype.sendMessage = function (body, nickname) {
  259. var msg = $msg({to: this.roomjid, type: 'groupchat'});
  260. msg.c('body', body).up();
  261. if (nickname) {
  262. msg.c('nick', {xmlns: 'http://jabber.org/protocol/nick'}).t(nickname).up().up();
  263. }
  264. this.connection.send(msg);
  265. this.eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body);
  266. };
  267. ChatRoom.prototype.setSubject = function (subject) {
  268. var msg = $msg({to: this.roomjid, type: 'groupchat'});
  269. msg.c('subject', subject);
  270. this.connection.send(msg);
  271. logger.log("topic changed to " + subject);
  272. };
  273. ChatRoom.prototype.onParticipantLeft = function (jid) {
  274. delete this.lastPresences[jid];
  275. this.eventEmitter.emit(XMPPEvents.MUC_MEMBER_LEFT, jid);
  276. this.moderator.onMucMemberLeft(jid);
  277. };
  278. ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
  279. // room destroyed ?
  280. if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]' +
  281. '>destroy').length) {
  282. var reason;
  283. var reasonSelect = $(pres).find(
  284. '>x[xmlns="http://jabber.org/protocol/muc#user"]' +
  285. '>destroy>reason');
  286. if (reasonSelect.length) {
  287. reason = reasonSelect.text();
  288. }
  289. this.xmpp.disposeConference(false);
  290. this.eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason);
  291. delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(jid)];
  292. return true;
  293. }
  294. // Status code 110 indicates that this notification is "self-presence".
  295. if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
  296. delete this.members[from];
  297. this.onParticipantLeft(from);
  298. }
  299. // If the status code is 110 this means we're leaving and we would like
  300. // to remove everyone else from our view, so we trigger the event.
  301. else if (Object.keys(this.members).length > 1) {
  302. for (var i in this.members) {
  303. var member = this.members[i];
  304. delete this.members[i];
  305. this.onParticipantLeft(member);
  306. }
  307. }
  308. if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {
  309. if (this.myroomjid === from) {
  310. this.xmpp.disposeConference(false);
  311. this.eventEmitter.emit(XMPPEvents.KICKED);
  312. }
  313. }
  314. };
  315. ChatRoom.prototype.onMessage = function (msg, from) {
  316. var nick =
  317. $(msg).find('>nick[xmlns="http://jabber.org/protocol/nick"]')
  318. .text() ||
  319. Strophe.getResourceFromJid(from);
  320. var txt = $(msg).find('>body').text();
  321. var type = msg.getAttribute("type");
  322. if (type == "error") {
  323. this.eventEmitter.emit(XMPPEvents.CHAT_ERROR_RECEIVED,
  324. $(msg).find('>text').text(), txt);
  325. return true;
  326. }
  327. var subject = $(msg).find('>subject');
  328. if (subject.length) {
  329. var subjectText = subject.text();
  330. if (subjectText || subjectText == "") {
  331. this.eventEmitter.emit(XMPPEvents.SUBJECT_CHANGED, subjectText);
  332. logger.log("Subject is changed to " + subjectText);
  333. }
  334. }
  335. // xep-0203 delay
  336. var stamp = $(msg).find('>delay').attr('stamp');
  337. if (!stamp) {
  338. // or xep-0091 delay, UTC timestamp
  339. stamp = $(msg).find('>[xmlns="jabber:x:delay"]').attr('stamp');
  340. if (stamp) {
  341. // the format is CCYYMMDDThh:mm:ss
  342. var dateParts = stamp.match(/(\d{4})(\d{2})(\d{2}T\d{2}:\d{2}:\d{2})/);
  343. stamp = dateParts[1] + "-" + dateParts[2] + "-" + dateParts[3] + "Z";
  344. }
  345. }
  346. if (txt) {
  347. logger.log('chat', nick, txt);
  348. this.eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED,
  349. from, nick, txt, this.myroomjid, stamp);
  350. }
  351. }
  352. ChatRoom.prototype.onPresenceError = function (pres, from) {
  353. if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
  354. logger.log('on password required', from);
  355. this.eventEmitter.emit(XMPPEvents.PASSWORD_REQUIRED);
  356. } else if ($(pres).find(
  357. '>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
  358. var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
  359. if (toDomain === this.xmpp.options.hosts.anonymousdomain) {
  360. // enter the room by replying with 'not-authorized'. This would
  361. // result in reconnection from authorized domain.
  362. // We're either missing Jicofo/Prosody config for anonymous
  363. // domains or something is wrong.
  364. this.eventEmitter.emit(XMPPEvents.ROOM_JOIN_ERROR, pres);
  365. } else {
  366. logger.warn('onPresError ', pres);
  367. this.eventEmitter.emit(XMPPEvents.ROOM_CONNECT_ERROR, pres);
  368. }
  369. } else {
  370. logger.warn('onPresError ', pres);
  371. this.eventEmitter.emit(XMPPEvents.ROOM_CONNECT_ERROR, pres);
  372. }
  373. };
  374. ChatRoom.prototype.kick = function (jid) {
  375. var kickIQ = $iq({to: this.roomjid, type: 'set'})
  376. .c('query', {xmlns: 'http://jabber.org/protocol/muc#admin'})
  377. .c('item', {nick: Strophe.getResourceFromJid(jid), role: 'none'})
  378. .c('reason').t('You have been kicked.').up().up().up();
  379. this.connection.sendIQ(
  380. kickIQ,
  381. function (result) {
  382. logger.log('Kick participant with jid: ', jid, result);
  383. },
  384. function (error) {
  385. logger.log('Kick participant error: ', error);
  386. });
  387. };
  388. ChatRoom.prototype.lockRoom = function (key, onSuccess, onError, onNotSupported) {
  389. //http://xmpp.org/extensions/xep-0045.html#roomconfig
  390. var ob = this;
  391. this.connection.sendIQ($iq({to: this.roomjid, type: 'get'}).c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'}),
  392. function (res) {
  393. if ($(res).find('>query>x[xmlns="jabber:x:data"]>field[var="muc#roomconfig_roomsecret"]').length) {
  394. var formsubmit = $iq({to: ob.roomjid, type: 'set'}).c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'});
  395. formsubmit.c('x', {xmlns: 'jabber:x:data', type: 'submit'});
  396. formsubmit.c('field', {'var': 'FORM_TYPE'}).c('value').t('http://jabber.org/protocol/muc#roomconfig').up().up();
  397. formsubmit.c('field', {'var': 'muc#roomconfig_roomsecret'}).c('value').t(key).up().up();
  398. // Fixes a bug in prosody 0.9.+ https://code.google.com/p/lxmppd/issues/detail?id=373
  399. formsubmit.c('field', {'var': 'muc#roomconfig_whois'}).c('value').t('anyone').up().up();
  400. // FIXME: is muc#roomconfig_passwordprotectedroom required?
  401. ob.connection.sendIQ(formsubmit,
  402. onSuccess,
  403. onError);
  404. } else {
  405. onNotSupported();
  406. }
  407. }, onError);
  408. };
  409. ChatRoom.prototype.addToPresence = function (key, values) {
  410. values.tagName = key;
  411. this.presMap["nodes"].push(values);
  412. };
  413. ChatRoom.prototype.removeFromPresence = function (key) {
  414. for(var i = 0; i < this.presMap.nodes.length; i++)
  415. {
  416. if(key === this.presMap.nodes[i].tagName)
  417. this.presMap.nodes.splice(i, 1);
  418. }
  419. };
  420. ChatRoom.prototype.addPresenceListener = function (name, handler) {
  421. this.presHandlers[name] = handler;
  422. }
  423. ChatRoom.prototype.removePresenceListener = function (name) {
  424. delete this.presHandlers[name];
  425. }
  426. ChatRoom.prototype.isModerator = function (jid) {
  427. return this.role === 'moderator';
  428. };
  429. ChatRoom.prototype.getMemberRole = function (peerJid) {
  430. if (this.members[peerJid]) {
  431. return this.members[peerJid].role;
  432. }
  433. return null;
  434. };
  435. ChatRoom.prototype.setJingleSession = function(session){
  436. this.session = session;
  437. this.session.room = this;
  438. };
  439. ChatRoom.prototype.removeStream = function (stream) {
  440. if(!this.session)
  441. return;
  442. this.session.peerconnection.removeStream(stream)
  443. }
  444. ChatRoom.prototype.switchStreams = function (stream, oldStream, callback, isAudio) {
  445. if(this.session) {
  446. // FIXME: will block switchInProgress on true value in case of exception
  447. this.session.switchStreams(stream, oldStream, callback, isAudio);
  448. } else {
  449. // We are done immediately
  450. logger.warn("No conference handler or conference not started yet");
  451. callback();
  452. }
  453. };
  454. ChatRoom.prototype.addStream = function (stream, callback) {
  455. if(this.session) {
  456. // FIXME: will block switchInProgress on true value in case of exception
  457. this.session.addStream(stream, callback);
  458. } else {
  459. // We are done immediately
  460. logger.warn("No conference handler or conference not started yet");
  461. callback();
  462. }
  463. }
  464. ChatRoom.prototype.setVideoMute = function (mute, callback, options) {
  465. var self = this;
  466. var localCallback = function (mute) {
  467. self.sendVideoInfoPresence(mute);
  468. if(callback)
  469. callback(mute)
  470. };
  471. if(this.session)
  472. {
  473. this.session.setVideoMute(
  474. mute, localCallback, options);
  475. }
  476. else {
  477. localCallback(mute);
  478. }
  479. };
  480. ChatRoom.prototype.setAudioMute = function (mute, callback) {
  481. //This will be for remote streams only
  482. // if (this.forceMuted && !mute) {
  483. // logger.info("Asking focus for unmute");
  484. // this.connection.moderate.setMute(this.connection.emuc.myroomjid, mute);
  485. // // FIXME: wait for result before resetting muted status
  486. // this.forceMuted = false;
  487. // }
  488. return this.sendAudioInfoPresence(mute, callback);
  489. };
  490. ChatRoom.prototype.addAudioInfoToPresence = function (mute) {
  491. this.removeFromPresence("audiomuted");
  492. this.addToPresence("audiomuted",
  493. {attributes:
  494. {"audions": "http://jitsi.org/jitmeet/audio"},
  495. value: mute.toString()});
  496. }
  497. ChatRoom.prototype.sendAudioInfoPresence = function(mute, callback) {
  498. this.addAudioInfoToPresence(mute);
  499. if(this.connection) {
  500. this.sendPresence();
  501. }
  502. if(callback)
  503. callback();
  504. };
  505. ChatRoom.prototype.addVideoInfoToPresence = function (mute) {
  506. this.removeFromPresence("videomuted");
  507. this.addToPresence("videomuted",
  508. {attributes:
  509. {"videons": "http://jitsi.org/jitmeet/video"},
  510. value: mute.toString()});
  511. }
  512. ChatRoom.prototype.sendVideoInfoPresence = function (mute) {
  513. this.addVideoInfoToPresence(mute);
  514. if(!this.connection)
  515. return;
  516. this.sendPresence();
  517. };
  518. ChatRoom.prototype.addListener = function(type, listener) {
  519. this.eventEmitter.on(type, listener);
  520. };
  521. ChatRoom.prototype.removeListener = function (type, listener) {
  522. this.eventEmitter.removeListener(type, listener);
  523. };
  524. ChatRoom.prototype.remoteStreamAdded = function(data, sid, thessrc) {
  525. if(this.lastPresences[data.peerjid])
  526. {
  527. var pres = this.lastPresences[data.peerjid];
  528. var audiomuted = filterNodeFromPresenceJSON(pres, "audiomuted");
  529. var videomuted = filterNodeFromPresenceJSON(pres, "videomuted");
  530. data.videomuted = ((videomuted.length > 0
  531. && videomuted[0]
  532. && videomuted[0]["value"] === "true")? true : false);
  533. data.audiomuted = ((audiomuted.length > 0
  534. && audiomuted[0]
  535. && audiomuted[0]["value"] === "true")? true : false);
  536. }
  537. this.eventEmitter.emit(XMPPEvents.REMOTE_STREAM_RECEIVED, data, sid, thessrc);
  538. }
  539. ChatRoom.prototype.getJidBySSRC = function (ssrc) {
  540. if (!this.session)
  541. return null;
  542. return this.session.getSsrcOwner(ssrc);
  543. };
  544. module.exports = ChatRoom;