Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ChatRoom.js 21KB

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