Adds SIP calls support

This commit is contained in:
hristoterezov 2015-12-29 17:52:24 -06:00
parent 3ec04d5a95
commit e494c3028d
3 changed files with 25 additions and 10 deletions

13
app.js
View File

@ -86,7 +86,6 @@ const APP = {
membersCount: 0,
audioMuted: false,
videoMuted: false,
sipGatewayEnabled: false, //FIXME handle
isLocalId (id) {
return this.localId === id;
},
@ -186,6 +185,10 @@ function initConference(localTracks, connection) {
APP.UI.addLocalStream(track);
};
APP.conference.sipGatewayEnabled = () => {
return room.isSIPCallingSupported();
};
function getDisplayName(id) {
if (APP.conference.isLocalId(id)) {
return APP.settings.getDisplayName();
@ -442,13 +445,7 @@ function initConference(localTracks, connection) {
});
APP.UI.addListener(UIEvents.SIP_DIAL, function (sipNumber) {
// FIXME add dial
// APP.xmpp.dial(
// sipNumber,
// 'fromnumber',
// APP.conference.roomName,
// roomLocker.password
// );
room.dial(sipNumber);
});

View File

@ -579,6 +579,15 @@ JitsiConference.prototype.toggleRecording = function (token, followEntity) {
reject(new Error("The conference is not created yet!"))});
}
/**
* Returns true if the SIP calls are supported and false otherwise
*/
JitsiConference.prototype.isSIPCallingSupported = function () {
if(this.room)
return this.room.isSIPCallingSupported();
return false;
}
/**
* Dials a number.
* @param number the number
@ -6753,6 +6762,15 @@ ChatRoom.prototype.toggleRecording = function (token, followEntity) {
reject(new Error("The conference is not created yet!"))});
}
/**
* Returns true if the SIP calls are supported and false otherwise
*/
ChatRoom.prototype.isSIPCallingSupported = function () {
if(this.moderator)
return this.moderator.isSipGatewayEnabled();
return false;
}
/**
* Dials a number.
* @param number the number
@ -10552,7 +10570,7 @@ function Moderator(roomName, xmpp, emitter) {
// Sip gateway can be enabled by configuring Jigasi host in config.js or
// it will be enabled automatically if focus detects the component through
// service discovery.
this.sipGatewayEnabled =
this.sipGatewayEnabled = this.xmppService.options.hosts &&
this.xmppService.options.hosts.call_control !== undefined;
this.eventEmitter = emitter;

View File

@ -311,7 +311,7 @@ const Toolbar = {
// Shows or hides SIP calls button
showSipCallButton (show) {
if (APP.conference.sipGatewayEnabled && UIUtil.isButtonEnabled('sip') && show) {
if (APP.conference.sipGatewayEnabled() && UIUtil.isButtonEnabled('sip') && show) {
$('#toolbar_button_sip').css({display: "inline-block"});
} else {
$('#toolbar_button_sip').css({display: "none"});