Bug 990472 - Part 2: Add check for more than 2 calls on line. r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2014-04-16 10:26:50 -04:00
parent c31a9c5dc3
commit 2fd164ece5

View File

@ -450,6 +450,29 @@ TelephonyProvider.prototype = {
return;
}
// All calls in the conference is regarded as one conference call.
function numCallsOnLine(aClientId) {
let numCalls = 0;
let hasConference = false;
for (let cid in this._currentCalls[aClientId]) {
let call = this._currentCalls[aClientId][cid];
if (call.isConference) {
hasConference = true;
} else {
numCalls++;
}
}
return hasConference ? numCalls + 1 : numCalls;
}
if (numCallsOnLine.call(this, aClientId) >= 2) {
if (DEBUG) debug("Has more than 2 calls on line. Drop.");
aTelephonyCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
return;
}
// we don't try to be too clever here, as the phone is probably in the
// locked state. Let's just check if it's a number without normalizing
if (!aIsEmergency) {