diff --git a/src/controllers/molecules/voip/CallView.js b/src/controllers/molecules/voip/CallView.js index e782f228..d511b9d4 100644 --- a/src/controllers/molecules/voip/CallView.js +++ b/src/controllers/molecules/voip/CallView.js @@ -15,11 +15,11 @@ limitations under the License. */ 'use strict'; -var dis = require("../../../dispatcher"); +var dis = require("matrix-react-sdk/lib/dispatcher"); var CallHandler = require("matrix-react-sdk/lib/CallHandler"); -var MatrixClientPeg = require("../../../MatrixClientPeg"); +var MatrixClientPeg = require("matrix-react-sdk/lib/MatrixClientPeg"); -var VectorConferenceHandler = require('./VectorConferenceHandler'); +var VectorConferenceHandler = require('../../../modules/VectorConferenceHandler'); /* * State vars: diff --git a/src/modules/VectorConferenceHandler.js b/src/modules/VectorConferenceHandler.js index 0d42461f..637e34f9 100644 --- a/src/modules/VectorConferenceHandler.js +++ b/src/modules/VectorConferenceHandler.js @@ -19,6 +19,7 @@ limitations under the License. var q = require("q"); var Matrix = require("matrix-js-sdk"); var Room = Matrix.Room; +var CallHandler = require('matrix-react-sdk/lib/CallHandler'); // FIXME: This currently forces Vector to try to hit the matrix.org AS for conferencing. // This is bad because it prevents people running their own ASes from being used. @@ -108,9 +109,24 @@ module.exports.getConferenceUserIdForRoom = function(roomId) { }; module.exports.createNewMatrixCall = function(client, roomId) { - return new ConferenceCall( + var confCall = new ConferenceCall( client, roomId ); + return confCall.setup(); +}; + +module.exports.getConferenceCallForRoom = function(roomId) { + // search for a conference 1:1 call for this group chat room ID + var activeCall = CallHandler.getAnyActiveCall(); + if (activeCall && activeCall.confUserId) { + var thisRoomConfUserId = module.exports.getConferenceUserIdForRoom( + roomId + ); + if (thisRoomConfUserId === activeCall.confUserId) { + return activeCall; + } + } + return null; }; module.exports.ConferenceCall = ConferenceCall; diff --git a/src/skins/vector/views/molecules/voip/CallView.js b/src/skins/vector/views/molecules/voip/CallView.js index 8cccc3c3..07987bd3 100644 --- a/src/skins/vector/views/molecules/voip/CallView.js +++ b/src/skins/vector/views/molecules/voip/CallView.js @@ -20,7 +20,7 @@ var React = require('react'); var sdk = require('matrix-react-sdk') var CallViewController = require( - "matrix-react-sdk/lib/controllers/molecules/voip/CallView" + "../../../../../controllers/molecules/voip/CallView" ); module.exports = React.createClass({