소스 검색

No longer requires focus component and focusUserJid to be configured in config.js(but they can still be overridden there).

j8
paweldomas 11 년 전
부모
커밋
933a41492e
3개의 변경된 파일29개의 추가작업 그리고 4개의 파일을 삭제
  1. 2
    2
      config.js
  2. 25
    1
      moderator.js
  3. 2
    1
      muc.js

+ 2
- 2
config.js 파일 보기

5
         muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030
5
         muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030
6
         bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030
6
         bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030
7
         //call_control: 'callcontrol.jitsi-meet.example.com',
7
         //call_control: 'callcontrol.jitsi-meet.example.com',
8
-        focus: 'focus.jitsi-meet.example.com'
8
+        //focus: 'focus.jitsi-meet.example.com' - defaults to 'focus.jitsi-meet.example.com'
9
     },
9
     },
10
 //  getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },
10
 //  getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },
11
 //  useStunTurn: true, // use XEP-0215 to fetch STUN and TURN server
11
 //  useStunTurn: true, // use XEP-0215 to fetch STUN and TURN server
13
     useNicks: false,
13
     useNicks: false,
14
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
14
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
15
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
15
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
16
-    focusUserJid: 'focus@auth.jitsi-meet.example.com', // The real JID of focus participant
16
+    //focusUserJid: 'focus@auth.jitsi-meet.example.com', // The real JID of focus participant - can be overridden here
17
     //defaultSipNumber: '', // Default SIP number
17
     //defaultSipNumber: '', // Default SIP number
18
     desktopSharing: 'ext', // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
18
     desktopSharing: 'ext', // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
19
     chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension
19
     chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension

+ 25
- 1
moderator.js 파일 보기

6
  */
6
  */
7
 var Moderator = (function (my) {
7
 var Moderator = (function (my) {
8
 
8
 
9
+    var focusUserJid;
9
     var getNextTimeout = Util.createExpBackoffTimer(1000);
10
     var getNextTimeout = Util.createExpBackoffTimer(1000);
10
     var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
11
     var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
11
 
12
 
66
         );
67
         );
67
     };
68
     };
68
 
69
 
70
+    my.setFocusUserJid = function (focusJid) {
71
+        if (!focusUserJid) {
72
+            focusUserJid = focusJid;
73
+            console.info("Focus jid set to: " + focusUserJid);
74
+        }
75
+    };
76
+
77
+    my.getFocusUserJid = function () {
78
+        return focusUserJid;
79
+    };
80
+
69
     my.createConferenceIq = function () {
81
     my.createConferenceIq = function () {
70
-        var elem = $iq({to: config.hosts.focus, type: 'set'});
82
+        // Get focus component address
83
+        var focusComponent = config.hosts.focus;
84
+        // If not specified use default: 'focus.domain'
85
+        if (!focusComponent) {
86
+            focusComponent = 'focus.' + config.hosts.domain;
87
+        }
88
+        // Generate create conference IQ
89
+        var elem = $iq({to: focusComponent, type: 'set'});
71
         elem.c('conference', {
90
         elem.c('conference', {
72
             xmlns: 'http://jitsi.org/protocol/focus',
91
             xmlns: 'http://jitsi.org/protocol/focus',
73
             room: roomName
92
             room: roomName
114
     // FIXME: we need to show the fact that we're waiting for the focus
133
     // FIXME: we need to show the fact that we're waiting for the focus
115
     // to the user(or that focus is not available)
134
     // to the user(or that focus is not available)
116
     my.allocateConferenceFocus = function (roomName, callback) {
135
     my.allocateConferenceFocus = function (roomName, callback) {
136
+        // Try to use focus user JID from the config
137
+        Moderator.setFocusUserJid(config.focusUserJid);
138
+        // Send create conference IQ
117
         var iq = Moderator.createConferenceIq();
139
         var iq = Moderator.createConferenceIq();
118
         connection.sendIQ(
140
         connection.sendIQ(
119
             iq,
141
             iq,
122
                     // Reset both timers
144
                     // Reset both timers
123
                     getNextTimeout(true);
145
                     getNextTimeout(true);
124
                     getNextErrorTimeout(true);
146
                     getNextErrorTimeout(true);
147
+                    Moderator.setFocusUserJid(
148
+                        $(result).find('conference').attr('focusjid'));
125
                     callback();
149
                     callback();
126
                 } else {
150
                 } else {
127
                     var waitMs = getNextTimeout();
151
                     var waitMs = getNextTimeout();

+ 2
- 1
muc.js 파일 보기

126
         // Focus recognition
126
         // Focus recognition
127
         member.jid = tmp.attr('jid');
127
         member.jid = tmp.attr('jid');
128
         member.isFocus = false;
128
         member.isFocus = false;
129
-        if (member.jid && member.jid.indexOf(config.focusUserJid + "/") == 0) {
129
+        if (member.jid
130
+            && member.jid.indexOf(Moderator.getFocusUserJid() + "/") == 0) {
130
             member.isFocus = true;
131
             member.isFocus = true;
131
         }
132
         }
132
 
133
 

Loading…
취소
저장