unHold() method

If a call object is added to the program, this method can run on it. It is used to put a call back from HOLD state to IN_CALL state. It reverses the effect of the hold() method.

Method usage example

You can register to the onIncomingCall event. If the webclient receives a call then the incoming function is called that will hold the old call and accept the new call. Then it will register to the onCallStateChanged event, which occurs when the state of the new call changes. When the event happens the callStateChanged function is called. This function hangs up the new call and unholds the old call if the new call is completed (Code example 1).

OzWebClient.onIncomingCall(incoming); //registers to the onIncomingCall event

function incoming(newCall) {
	oldCall.hold(); //hold the old call
	newCall.accept(); //accepts the new call
	newCall.onCallStateChanged(callStateChanged); //registers to the onCallStateChanged event
}
  
function callStateChanged(state) {
	if (state == "COMPLETED") { //if the state of the new call is completed
		newCall.hangUp(); //hang up the new call and
		oldCall.unHold(); //unhold the old call
	}	
}
	
Code example 1 - unHold() method example

More information