mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Automatically close ring screen if other peer gives up with connection
This commit is contained in:
parent
1a3117a603
commit
5a067001e9
@ -184,13 +184,36 @@ ComunicWeb.components.calls.controller = {
|
||||
}
|
||||
|
||||
//Show ring screen
|
||||
ComunicWeb.components.calls.ringScreen.show(name, 30, function(accept){
|
||||
var prompting = true;
|
||||
var ringScreenInfo = ComunicWeb.components.calls.ringScreen.show(name, 30, function(accept){
|
||||
|
||||
prompting = false;
|
||||
|
||||
undoIsProcessing();
|
||||
|
||||
ComunicWeb.components.calls.controller.applyReponseForCall(call, accept);
|
||||
|
||||
});
|
||||
|
||||
//Regulary check if the call is still valid
|
||||
var interval = setInterval(function(){
|
||||
|
||||
if(!prompting)
|
||||
return clearInterval(interval);
|
||||
|
||||
ComunicWeb.components.calls.interface.getInfo(call.id, function(info){
|
||||
|
||||
//Check for errors
|
||||
if(info.error)
|
||||
return;
|
||||
|
||||
//Refuse the call if everyone has left it
|
||||
if(ComunicWeb.components.calls.utils.hasEveryoneLeft(info))
|
||||
ringScreenInfo.respond(false);
|
||||
});
|
||||
}, 2000);
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -23,6 +23,7 @@ ComunicWeb.components.calls.ringScreen = {
|
||||
* @param {number} timeout Timeout after which the call is automatically
|
||||
* considered as rejected
|
||||
* @param {(accept : boolean) => any} callback Callback function
|
||||
* @return {Object} Information about the window
|
||||
*/
|
||||
show: function(title, timeout, callback){
|
||||
|
||||
@ -98,6 +99,15 @@ ComunicWeb.components.calls.ringScreen = {
|
||||
setTimeout(function(){
|
||||
respond(false);
|
||||
}, timeout*1000);
|
||||
|
||||
return {
|
||||
|
||||
/**
|
||||
* A function to programmatically respond to call
|
||||
*/
|
||||
respond: respond
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user