Actually enforce 1 call semantics.

This commit is contained in:
Kegan Dougal 2015-09-15 11:43:51 +01:00
parent 59986d8b72
commit 5e3698de64

View File

@ -154,7 +154,11 @@ function _setCallState(call, roomId, status) {
dis.register(function(payload) { dis.register(function(payload) {
switch (payload.action) { switch (payload.action) {
case 'place_call': case 'place_call':
if (calls[payload.room_id]) { if (module.exports.getAnyActiveCall()) {
Modal.createDialog(ErrorDialog, {
title: "Existing Call",
description: "You are already in a call."
});
return; // don't allow >1 call to be placed. return; // don't allow >1 call to be placed.
} }
var room = MatrixClientPeg.get().getRoom(payload.room_id); var room = MatrixClientPeg.get().getRoom(payload.room_id);
@ -207,7 +211,7 @@ dis.register(function(payload) {
} }
break; break;
case 'incoming_call': case 'incoming_call':
if (calls[payload.call.roomId]) { if (module.exports.getAnyActiveCall()) {
payload.call.hangup("busy"); payload.call.hangup("busy");
return; // don't allow >1 call to be received, hangup newer one. return; // don't allow >1 call to be received, hangup newer one.
} }