Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  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. // store the new display name
  247. if(member.displayName)
  248. this.members[from].displayName = member.displayName;
  249. }
  250. if(!member.isFocus)
  251. this.eventEmitter.emit(XMPPEvents.USER_ID_CHANGED, from, member.id || member.email);
  252. // Trigger status message update
  253. if (member.status) {
  254. this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member);
  255. }
  256. };
  257. ChatRoom.prototype.processNode = function (node, from) {
  258. if(this.presHandlers[node.tagName])
  259. this.presHandlers[node.tagName](node, from);
  260. };
  261. ChatRoom.prototype.sendMessage = function (body, nickname) {
  262. var msg = $msg({to: this.roomjid, type: 'groupchat'});
  263. msg.c('body', body).up();
  264. if (nickname) {
  265. msg.c('nick', {xmlns: 'http://jabber.org/protocol/nick'}).t(nickname).up().up();
  266. }
  267. this.connection.send(msg);
  268. this.eventEmitter.emit(XMPPEvents.SENDING_CHAT_MESSAGE, body);
  269. };
  270. ChatRoom.prototype.setSubject = function (subject) {
  271. var msg = $msg({to: this.roomjid, type: 'groupchat'});
  272. msg.c('subject', subject);
  273. this.connection.send(msg);
  274. logger.log("topic changed to " + subject);
  275. };
  276. ChatRoom.prototype.onParticipantLeft = function (jid) {
  277. delete this.lastPresences[jid];
  278. this.eventEmitter.emit(XMPPEvents.MUC_MEMBER_LEFT, jid);
  279. this.moderator.onMucMemberLeft(jid);
  280. };
  281. ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
  282. // room destroyed ?
  283. if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]' +
  284. '>destroy').length) {
  285. var reason;
  286. var reasonSelect = $(pres).find(
  287. '>x[xmlns="http://jabber.org/protocol/muc#user"]' +
  288. '>destroy>reason');
  289. if (reasonSelect.length) {
  290. reason = reasonSelect.text();
  291. }
  292. this.xmpp.disposeConference(false);
  293. this.eventEmitter.emit(XMPPEvents.MUC_DESTROYED, reason);
  294. delete this.connection.emuc.rooms[Strophe.getBareJidFromJid(jid)];
  295. return true;
  296. }
  297. // Status code 110 indicates that this notification is "self-presence".
  298. if (!$(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="110"]').length) {
  299. delete this.members[from];
  300. this.onParticipantLeft(from);
  301. }
  302. // If the status code is 110 this means we're leaving and we would like
  303. // to remove everyone else from our view, so we trigger the event.
  304. else if (Object.keys(this.members).length > 1) {
  305. for (var i in this.members) {
  306. var member = this.members[i];
  307. delete this.members[i];
  308. this.onParticipantLeft(member);
  309. }
  310. }
  311. if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="307"]').length) {
  312. if (this.myroomjid === from) {
  313. this.xmpp.disposeConference(false);
  314. this.eventEmitter.emit(XMPPEvents.KICKED);
  315. }
  316. }
  317. };
  318. ChatRoom.prototype.onMessage = function (msg, from) {
  319. var nick =
  320. $(msg).find('>nick[xmlns="http://jabber.org/protocol/nick"]')
  321. .text() ||
  322. Strophe.getResourceFromJid(from);
  323. var txt = $(msg).find('>body').text();
  324. var type = msg.getAttribute("type");
  325. if (type == "error") {
  326. this.eventEmitter.emit(XMPPEvents.CHAT_ERROR_RECEIVED,
  327. $(msg).find('>text').text(), txt);
  328. return true;
  329. }
  330. var subject = $(msg).find('>subject');
  331. if (subject.length) {
  332. var subjectText = subject.text();
  333. if (subjectText || subjectText == "") {
  334. this.eventEmitter.emit(XMPPEvents.SUBJECT_CHANGED, subjectText);
  335. logger.log("Subject is changed to " + subjectText);
  336. }
  337. }
  338. // xep-0203 delay
  339. var stamp = $(msg).find('>delay').attr('stamp');
  340. if (!stamp) {
  341. // or xep-0091 delay, UTC timestamp
  342. stamp = $(msg).find('>[xmlns="jabber:x:delay"]').attr('stamp');
  343. if (stamp) {
  344. // the format is CCYYMMDDThh:mm:ss
  345. var dateParts = stamp.match(/(\d{4})(\d{2})(\d{2}T\d{2}:\d{2}:\d{2})/);
  346. stamp = dateParts[1] + "-" + dateParts[2] + "-" + dateParts[3] + "Z";
  347. }
  348. }
  349. if (txt) {
  350. logger.log('chat', nick, txt);
  351. this.eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED,
  352. from, nick, txt, this.myroomjid, stamp);
  353. }
  354. }
  355. ChatRoom.prototype.onPresenceError = function (pres, from) {
  356. if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
  357. logger.log('on password required', from);
  358. this.eventEmitter.emit(XMPPEvents.PASSWORD_REQUIRED);
  359. } else if ($(pres).find(
  360. '>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
  361. var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
  362. if (toDomain === this.xmpp.options.hosts.anonymousdomain) {
  363. // enter the room by replying with 'not-authorized'. This would
  364. // result in reconnection from authorized domain.
  365. // We're either missing Jicofo/Prosody config for anonymous
  366. // domains or something is wrong.
  367. this.eventEmitter.emit(XMPPEvents.ROOM_JOIN_ERROR, pres);
  368. } else {
  369. logger.warn('onPresError ', pres);
  370. this.eventEmitter.emit(XMPPEvents.ROOM_CONNECT_ERROR, pres);
  371. }
  372. } else {
  373. logger.warn('onPresError ', pres);
  374. this.eventEmitter.emit(XMPPEvents.ROOM_CONNECT_ERROR, pres);
  375. }
  376. };
  377. ChatRoom.prototype.kick = function (jid) {
  378. var kickIQ = $iq({to: this.roomjid, type: 'set'})
  379. .c('query', {xmlns: 'http://jabber.org/protocol/muc#admin'})
  380. .c('item', {nick: Strophe.getResourceFromJid(jid), role: 'none'})
  381. .c('reason').t('You have been kicked.').up().up().up();
  382. this.connection.sendIQ(
  383. kickIQ,
  384. function (result) {
  385. logger.log('Kick participant with jid: ', jid, result);
  386. },
  387. function (error) {
  388. logger.log('Kick participant error: ', error);
  389. });
  390. };
  391. ChatRoom.prototype.lockRoom = function (key, onSuccess, onError, onNotSupported) {
  392. //http://xmpp.org/extensions/xep-0045.html#roomconfig
  393. var ob = this;
  394. this.connection.sendIQ($iq({to: this.roomjid, type: 'get'}).c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'}),
  395. function (res) {
  396. if ($(res).find('>query>x[xmlns="jabber:x:data"]>field[var="muc#roomconfig_roomsecret"]').length) {
  397. var formsubmit = $iq({to: ob.roomjid, type: 'set'}).c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'});
  398. formsubmit.c('x', {xmlns: 'jabber:x:data', type: 'submit'});
  399. formsubmit.c('field', {'var': 'FORM_TYPE'}).c('value').t('http://jabber.org/protocol/muc#roomconfig').up().up();
  400. formsubmit.c('field', {'var': 'muc#roomconfig_roomsecret'}).c('value').t(key).up().up();
  401. // Fixes a bug in prosody 0.9.+ https://code.google.com/p/lxmppd/issues/detail?id=373
  402. formsubmit.c('field', {'var': 'muc#roomconfig_whois'}).c('value').t('anyone').up().up();
  403. // FIXME: is muc#roomconfig_passwordprotectedroom required?
  404. ob.connection.sendIQ(formsubmit,
  405. onSuccess,
  406. onError);
  407. } else {
  408. onNotSupported();
  409. }
  410. }, onError);
  411. };
  412. ChatRoom.prototype.addToPresence = function (key, values) {
  413. values.tagName = key;
  414. this.presMap["nodes"].push(values);
  415. };
  416. ChatRoom.prototype.removeFromPresence = function (key) {
  417. for(var i = 0; i < this.presMap.nodes.length; i++)
  418. {
  419. if(key === this.presMap.nodes[i].tagName)
  420. this.presMap.nodes.splice(i, 1);
  421. }
  422. };
  423. ChatRoom.prototype.addPresenceListener = function (name, handler) {
  424. this.presHandlers[name] = handler;
  425. }
  426. ChatRoom.prototype.removePresenceListener = function (name) {
  427. delete this.presHandlers[name];
  428. }
  429. ChatRoom.prototype.isModerator = function (jid) {
  430. return this.role === 'moderator';
  431. };
  432. ChatRoom.prototype.getMemberRole = function (peerJid) {
  433. if (this.members[peerJid]) {
  434. return this.members[peerJid].role;
  435. }
  436. return null;
  437. };
  438. ChatRoom.prototype.setJingleSession = function(session){
  439. this.session = session;
  440. this.session.room = this;
  441. };
  442. ChatRoom.prototype.removeStream = function (stream) {
  443. if(!this.session)
  444. return;
  445. this.session.peerconnection.removeStream(stream)
  446. }
  447. ChatRoom.prototype.switchStreams = function (stream, oldStream, callback, isAudio) {
  448. if(this.session) {
  449. // FIXME: will block switchInProgress on true value in case of exception
  450. this.session.switchStreams(stream, oldStream, callback, isAudio);
  451. } else {
  452. // We are done immediately
  453. logger.warn("No conference handler or conference not started yet");
  454. callback();
  455. }
  456. };
  457. ChatRoom.prototype.addStream = function (stream, callback) {
  458. if(this.session) {
  459. // FIXME: will block switchInProgress on true value in case of exception
  460. this.session.addStream(stream, callback);
  461. } else {
  462. // We are done immediately
  463. logger.warn("No conference handler or conference not started yet");
  464. callback();
  465. }
  466. }
  467. ChatRoom.prototype.setVideoMute = function (mute, callback, options) {
  468. var self = this;
  469. var localCallback = function (mute) {
  470. self.sendVideoInfoPresence(mute);
  471. if(callback)
  472. callback(mute)
  473. };
  474. if(this.session)
  475. {
  476. this.session.setVideoMute(
  477. mute, localCallback, options);
  478. }
  479. else {
  480. localCallback(mute);
  481. }
  482. };
  483. ChatRoom.prototype.setAudioMute = function (mute, callback) {
  484. //This will be for remote streams only
  485. // if (this.forceMuted && !mute) {
  486. // logger.info("Asking focus for unmute");
  487. // this.connection.moderate.setMute(this.connection.emuc.myroomjid, mute);
  488. // // FIXME: wait for result before resetting muted status
  489. // this.forceMuted = false;
  490. // }
  491. return this.sendAudioInfoPresence(mute, callback);
  492. };
  493. ChatRoom.prototype.addAudioInfoToPresence = function (mute) {
  494. this.removeFromPresence("audiomuted");
  495. this.addToPresence("audiomuted",
  496. {attributes:
  497. {"audions": "http://jitsi.org/jitmeet/audio"},
  498. value: mute.toString()});
  499. }
  500. ChatRoom.prototype.sendAudioInfoPresence = function(mute, callback) {
  501. this.addAudioInfoToPresence(mute);
  502. if(this.connection) {
  503. this.sendPresence();
  504. }
  505. if(callback)
  506. callback();
  507. };
  508. ChatRoom.prototype.addVideoInfoToPresence = function (mute) {
  509. this.removeFromPresence("videomuted");
  510. this.addToPresence("videomuted",
  511. {attributes:
  512. {"videons": "http://jitsi.org/jitmeet/video"},
  513. value: mute.toString()});
  514. }
  515. ChatRoom.prototype.sendVideoInfoPresence = function (mute) {
  516. this.addVideoInfoToPresence(mute);
  517. if(!this.connection)
  518. return;
  519. this.sendPresence();
  520. };
  521. ChatRoom.prototype.addListener = function(type, listener) {
  522. this.eventEmitter.on(type, listener);
  523. };
  524. ChatRoom.prototype.removeListener = function (type, listener) {
  525. this.eventEmitter.removeListener(type, listener);
  526. };
  527. ChatRoom.prototype.remoteStreamAdded = function(data, sid, thessrc) {
  528. if(this.lastPresences[data.peerjid])
  529. {
  530. var pres = this.lastPresences[data.peerjid];
  531. var audiomuted = filterNodeFromPresenceJSON(pres, "audiomuted");
  532. var videomuted = filterNodeFromPresenceJSON(pres, "videomuted");
  533. data.videomuted = ((videomuted.length > 0
  534. && videomuted[0]
  535. && videomuted[0]["value"] === "true")? true : false);
  536. data.audiomuted = ((audiomuted.length > 0
  537. && audiomuted[0]
  538. && audiomuted[0]["value"] === "true")? true : false);
  539. }
  540. this.eventEmitter.emit(XMPPEvents.REMOTE_STREAM_RECEIVED, data, sid, thessrc);
  541. }
  542. ChatRoom.prototype.getJidBySSRC = function (ssrc) {
  543. if (!this.session)
  544. return null;
  545. return this.session.getSsrcOwner(ssrc);
  546. };
  547. module.exports = ChatRoom;