diff --git a/JitsiConference.js b/JitsiConference.js index 6b0d18ad9..6ca4b1b46 100644 --- a/JitsiConference.js +++ b/JitsiConference.js @@ -454,6 +454,45 @@ JitsiConference.prototype.toggleRecording = function (token) { 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; +} + /** * Setups the listeners needed for the conference. * @param conference the conference @@ -495,8 +534,16 @@ function setupListeners(conference) { conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () { 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.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 () { diff --git a/JitsiConferenceEvents.js b/JitsiConferenceEvents.js index 3ea10fb95..72c0596fe 100644 --- a/JitsiConferenceEvents.js +++ b/JitsiConferenceEvents.js @@ -87,7 +87,11 @@ var JitsiConferenceEvents = { /** * Indicates that recording state changed. */ - RECORDING_STATE_CHANGED: "conference.recordingStateChanged" + RECORDING_STATE_CHANGED: "conference.recordingStateChanged", + /** + * Indicates that phone number changed. + */ + PHONE_NUMBER_CHANGED: "conference.phoneNumberChanged" }; module.exports = JitsiConferenceEvents; diff --git a/doc/example/example.js b/doc/example/example.js index aa991e86e..f5eeda052 100644 --- a/doc/example/example.js +++ b/doc/example/example.js @@ -1,5 +1,7 @@ var options = { hosts: { + 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 @@ -37,8 +39,8 @@ function onLocalTracks(tracks) $("body").append("