mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Automatically close ring screen if other peer gives up with connection
This commit is contained in:
		@@ -184,13 +184,36 @@ ComunicWeb.components.calls.controller = {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				//Show ring screen
 | 
									//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();
 | 
										undoIsProcessing();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					ComunicWeb.components.calls.controller.applyReponseForCall(call, accept);
 | 
										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
 | 
						 * @param {number} timeout Timeout after which the call is automatically
 | 
				
			||||||
	 * considered as rejected
 | 
						 * considered as rejected
 | 
				
			||||||
	 * @param {(accept : boolean) => any} callback Callback function
 | 
						 * @param {(accept : boolean) => any} callback Callback function
 | 
				
			||||||
 | 
						 * @return {Object} Information about the window
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	show: function(title, timeout, callback){
 | 
						show: function(title, timeout, callback){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -98,6 +99,15 @@ ComunicWeb.components.calls.ringScreen = {
 | 
				
			|||||||
		setTimeout(function(){
 | 
							setTimeout(function(){
 | 
				
			||||||
			respond(false);
 | 
								respond(false);
 | 
				
			||||||
		}, timeout*1000);
 | 
							}, timeout*1000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/**
 | 
				
			||||||
 | 
								 * A function to programmatically respond to call
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								respond: respond
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user