Dealing with failed calls
Your function must cater for failed connections. At a minimum, you should set the function’s return value to False so that the main part of the interview script can display a suitable message for the interviewer. The example script in ‘Writing an IVR hand-off function’ on page 934 contains the following code:
If (IVRCall.State = 2) Then
' Connection made. Transfer the call.
...
TransferToIVR = True
Else
' No connection - something went wrong.
TransferToIVR = False
End If
You may want to extend this so that the function provides the interviewer with more information about why the call has failed. Here’s some code that passes back a description of the error that the dialer returned when it was unable to place the call. The metadata contains an information item that displays this description for the interviewer:
ErrMsg "I'm sorry, there is a technical problem transfering you
to the automated system. Thank you very much for your time.
(Error: {ErrorDescription})" info;
The Transfer function then contains the following code to deal with failed calls:
If (IVRCall.State = 2) Then
...
Else
' The call terminated - something went wrong.
IOM.Questions["ErrMsg"].Label.Inserts["ErrorDescription"] = _
GetOutcomeDescription(IVRCall.Outcome))
TransferToIVR = False
End If
GetOutcomeDescription is a user-defined function that looks like this:
Function GetOutcomeDescription(Outcome)
Select Case Outcome
Case 0
GetOutcomeDescription = "No outcome as the call is still in progress or connected."
Case 1
GetOutcomeDescription = "The number dialed was unobtainable. This is because the number is unallocated/unassigned."
...
Case 22
GetOutcomeDescription = "The number is a fax or modem."
End Select
End Function
Refer to CallOutcome in the UNICOM Intelligence Developer Documentation Library for a full list of the dialer’s call outcome codes.
See also
‘Writing an IVR hand-off function’ on page 1121