mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +00:00
Automatically close call when a user is the last on a call.
This commit is contained in:
parent
ece7a97d42
commit
590e1d6794
@ -319,19 +319,19 @@ ComunicWeb.components.calls.callWindow = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Check if all other members rejected call
|
//Check if all other members rejected call
|
||||||
var allRejected = true;
|
var allDisconnected = true;
|
||||||
call.info.members.forEach(function(member){
|
call.info.members.forEach(function(member){
|
||||||
if(member.status != "rejected" && member.userID != userID())
|
if(member.status != "rejected" && member.status != "hang_up" && member.userID != userID())
|
||||||
allRejected = false;
|
allDisconnected = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
//Check if all call peer rejected the call
|
//Check if all call peer rejected the call
|
||||||
if(allRejected){
|
if(allDisconnected){
|
||||||
call.setLoadingMessage("All other peers rejected the call !");
|
call.setLoadingMessage("Conversation terminated.");
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
call.close();
|
call.close();
|
||||||
}, 20000);
|
}, 5000);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -542,5 +542,8 @@ ComunicWeb.components.calls.callWindow = {
|
|||||||
element.removePeerConnection();
|
element.removePeerConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Notify server
|
||||||
|
ComunicWeb.components.calls.interface.hangUp(call.info.id, function(){});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -82,5 +82,22 @@ ComunicWeb.components.calls.interface = {
|
|||||||
true,
|
true,
|
||||||
callback
|
callback
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hang up a call
|
||||||
|
*
|
||||||
|
* @param {Number} call_id The ID of the target call
|
||||||
|
* @param {function} callback Function to call on call callback
|
||||||
|
*/
|
||||||
|
hangUp: function(call_id, callback){
|
||||||
|
ComunicWeb.common.api.makeAPIrequest(
|
||||||
|
"calls/hangUp",
|
||||||
|
{
|
||||||
|
call_id: call_id,
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
callback
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user