diff --git a/JitsiConference.js b/JitsiConference.js index 143349448..fc93196e8 100644 --- a/JitsiConference.js +++ b/JitsiConference.js @@ -496,6 +496,84 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) { this.dtmfManager.sendTones(tones, duration, pause); }; +/** + * Returns true if the recording is supproted and false if not. + */ +JitsiConference.prototype.isRecordingSupported = function () { + if(this.room) + return this.room.isRecordingSupported(); + return false; +}; + +/** + * Returns null if the recording is not supported, "on" if the recording started + * and "off" if the recording is not started. + */ +JitsiConference.prototype.getRecordingState = function () { + if(this.room) + return this.room.getRecordingState(); + return "off"; +} + +/** + * Returns the url of the recorded video. + */ +JitsiConference.prototype.getRecordingURL = function () { + if(this.room) + return this.room.getRecordingURL(); + return null; +} + +/** + * Starts/stops the recording + * @param token a token for authentication. + */ +JitsiConference.prototype.toggleRecording = function (token, followEntity) { + if(this.room) + return this.room.toggleRecording(token, followEntity); + return new Promise(function(resolve, reject){ + reject(new Error("The conference is not created yet!"))}); +} + +/** + * Dials a number. + * @param number the number + */ +JitsiConference.prototype.dial = function (number) { + if(this.room) + return this.room.dial(number); + return new Promise(function(resolve, reject){ + reject(new Error("The conference is not created yet!"))}); +} + +/** + * Hangup an existing call + */ +JitsiConference.prototype.hangup = function () { + if(this.room) + return this.room.hangup(); + return new Promise(function(resolve, reject){ + reject(new Error("The conference is not created yet!"))}); +} + +/** + * Returns the phone number for joining the conference. + */ +JitsiConference.prototype.getPhoneNumber = function () { + if(this.room) + return this.room.getPhoneNumber(); + return null; +} + +/** + * Returns the pin for joining the conference with phone. + */ +JitsiConference.prototype.getPhonePin = function () { + if(this.room) + return this.room.getPhonePin(); + return null; +} + /** * Returns the connection state for the current room. Its ice connection state * for its session. @@ -560,6 +638,17 @@ function setupListeners(conference) { conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED); }); + conference.room.addListener(XMPPEvents.RECORDING_STATE_CHANGED, + function () { + conference.eventEmitter.emit( + JitsiConferenceEvents.RECORDING_STATE_CHANGED); + }); + + conference.room.addListener(XMPPEvents.PHONE_NUMBER_CHANGED, function () { + conference.eventEmitter.emit( + JitsiConferenceEvents.PHONE_NUMBER_CHANGED); + }); + conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () { conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED); }); diff --git a/JitsiConferenceEvents.js b/JitsiConferenceEvents.js index 57aa87ace..a597fc045 100644 --- a/JitsiConferenceEvents.js +++ b/JitsiConferenceEvents.js @@ -83,7 +83,15 @@ var JitsiConferenceEvents = { /** * Indicates that DTMF support changed. */ - DTMF_SUPPORT_CHANGED: "conference.dtmfSupportChanged" + DTMF_SUPPORT_CHANGED: "conference.dtmfSupportChanged", + /** + * Indicates that recording state changed. + */ + RECORDING_STATE_CHANGED: "conference.recordingStateChanged", + /** + * Indicates that phone number changed. + */ + PHONE_NUMBER_CHANGED: "conference.phoneNumberChanged" }; module.exports = JitsiConferenceEvents; diff --git a/JitsiConnection.js b/JitsiConnection.js index 8ce737e36..ef1d749d2 100644 --- a/JitsiConnection.js +++ b/JitsiConnection.js @@ -8,9 +8,8 @@ var RandomUtil = require("./modules/util/RandomUtil"); * @returns {string} */ function generateUserName() { - return RandomUtil.randomHexString(8) + "-" + RandomUtil.randomHexString(4) + - "-" + RandomUtil.randomHexString(4) + "-" + - RandomUtil.randomHexDigit(8); + return RandomUtil.random8digitsHex() + "-" + RandomUtil.random4digitsHex() + "-" + + RandomUtil.random4digitsHex() + "-" + RandomUtil.random8digitsHex(); } /** diff --git a/doc/example/example.js b/doc/example/example.js index e5b4c76a4..181fc5910 100644 --- a/doc/example/example.js +++ b/doc/example/example.js @@ -1,10 +1,12 @@ var options = { hosts: { - domain: 'hristo.jitsi.net', - muc: 'conference.hristo.jitsi.net', // FIXME: use XEP-0030 - bridge: 'jitsi-videobridge.hristo.jitsi.net', // FIXME: use XEP-0030 + call_control: "callcontrol.chaos.hipchat.me", + focus: "focus.chaos.hipchat.me", + domain: 'chaos.hipchat.me', + muc: 'conference.chaos.hipchat.me', // FIXME: use XEP-0030 + bridge: 'jitsi-videobridge.chaos.hipchat.me', // FIXME: use XEP-0030 }, - bosh: '//hristo.jitsi.net/http-bind', // FIXME: use xep-0156 for that + bosh: '//chaos.hipchat.me/http-bind', // FIXME: use xep-0156 for that clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza } @@ -40,7 +42,7 @@ function onLocalTracks(tracks) $("body").append("