Transferring a call to an agent

Many voice applications give the caller the option of speaking to a real person. Your application can either transfer blind (without checking that an agent is available) or it can check before transferring the call.

Blind Transfer

To transfer the caller to an agent without first checking that an agent is available, use the Call.blindTransfer() method. This method calls a specified number and transfers the caller to the ringing call. The first call becomes inactive. If an agent is not available, the caller is left to hang up. If an agent is available, the call is dealt with by them and if necessary the caller can be transferred to another instance of the original application (or to another application) by the agent.

Note: To transfer a call and for consulting and conferencing functions, the application uses the methods in the Call class. The call transfer can be done by a telephony service. To use a telephony service, follow the instructions in "Adding Telephony Capability", in Blueworx Voice Response for AIX: Deploying and Managing VoiceXML and Java Applications.
To transfer the caller to an agent simply invoke the Call.blindTransfer() method with the telephone number of the agent. For example:
  .
  .
  .
  // Tell the caller they are being transferred to an agent by playing a
  // voice segment
  call.play(VS_Being_Transferred);
	
  // Transfer caller to agent
  call.blindTransfer("7001");
	
  // No further action required. The call object is now invalid, and any
  // methods called on it will throw an exception
  .
  .
  .

To set up a blind conference call, the process is similar to that shown in Figure 1.

Figure 1. Transferring the caller to an agent
Transferring the caller to an agent

Consulting with an agent while keeping the caller on hold

In this scenario, the voice application puts the caller on hold while it consults an agent. The application uses the Call.consult() method to check that the agent is there, as shown in Figure 2. The application places the current call on hold, then uses the same line to call the specified number. If the agent is there, the voice application uses Call.transfer() to transfer the caller to the agent. If the agent is not there, the application uses Call.retrieve() to return to the original caller.

To transfer the caller to an agent invoke the Call.consult() method. This method returns a Call object representing the new call between the application and the agent — the original caller is now on hold. You can use this Call object to play messages to the agent before transferring the caller using the Call.transfer() method. If the agent is not available, or the transfer fails for some other reason, use the Call.retrieve() method as shown in Figure 2 to retrieve the original call from its held state. The transfer call is now inactive. For example:
  .
  .
  .
  try {	
    // Make another call to the agent on telephone number "7001".
    // The caller is now on hold
    Call transferCall = originalCall.consult("7001");
		
    // Tell the agent they have a caller by playing a voice segment
    transferCall.play(VS_Caller_For_You);
		
    // Transfer the caller to the agent
    originalCall.transfer();
		
    // No further action required on the original call
  }
  catch (WVRException e) {
    // In the event of an exception, get the original caller back
    originalCall.retrieve();
		
    // Tell the caller that an agent was not available
    originalCall.play(VS_Agent_Not_Avail);
	
    // Continue with call
    .
    .
    .
  }//try
  .
  .
  .
Figure 2. Consultation with an agent while the caller is on hold
This picture shows the transfer of the caller to an agent.
Figure 3. Retrieving a call from an agent
This picture shows consultation with an agent while the caller is on hold.
To set up a conference call, use the Call.conference() method once the Call.consult() method has established the new call. If the conference is successful any further actions such as play and record will occur on both calls.
Note: The base Blueworx Voice Response for AIX system does not support call conference. To use the Call.conference() method on AIX you must have a telephony service.