Professional > Interview scripting > Writing interview scripts > Interactive Voice Response interviews > Writing an IVR hand-off function > Dialing the IVR system
 
Dialing the IVR system
To dial the IVR system, use the IGroup.DialCallIGroup.DialCall method in the QSAMP dialer interface component. A simplified explanation of this method as it applies to IVR hand-off is as follows (follow the link for a full technical description). To use another dialer's IVR system, see the dialer’s documentation.
Set variable = _Dialer.Groups["GName"].DialCall(IVR_telnum, , , , [NA_time-out], , DTMF)
where:
variable is the name of the Call object that will store the result of the call.
GName is the name of the extension group that will use IVR. The default is ivr_xfer (group number 997). This functionality has to be configured as part of your autodialer set-up.
IVR_telnum is the IVR telephone number. You can either enter it directly in the statement, enclosed in double quotation marks, or you can define it as a constant and use the constant’s name in the statement. In both cases, type only the digits that are to be dialed; do not include spaces or other formatting characters.
NA_time-out is the no-answer time-out delay for the call in seconds. The default is 30 seconds. If you do not specify a value, remember to include the terminating comma otherwise the remaining parameters will be read incorrectly.
DTMF is the DTMF string to send to the IVR system immediately after connecting. For example, if your IVR system requires a # character in order to jump to the first unanswered question in the script, you would enter at least this character in the DTMF string. The string must be enclosed in double quotation marks and can be entered directly into the DialCall statement or defined as a constant that is then named in the statement. See ‘Passing information to the IVR system’ on page 936 for more information.
(_Dialer and _Extension are hidden variables in the main interview script and are passed to the IVR hand-off function. They always exist, but are null if they are not relevant to the interview, for example, if running in UNICOM Intelligence Professional; if the interview is not a telephone interview; or the dialer that you use does not support them.)
In the example function, the statement that calls the IVR system is:
Set IVRCall = _Dialer.Groups["ivr_xfer"].DialCall(IVR_NO, , , , 5, , DTMF)
This places a call for the ivr_xfer extension group (this is a group that is created automatically as soon as your dialer is configured to have at least one IVR seat). It dials the number defined in the IVR_NO constant and waits a maximum of five seconds for the call to be answered. If the call is answered, the string defined in the DTMF variable is passed to IVR. Defaults are used for all other parameters.
When the interviewing program reads the DialCall statement, it places a call to the IVR system. The Call.State property that records the status of the call changes to 2 if the call connects or to 3 if the call is terminated for any reason, for example, if the call fails. See ICall.StateICall.State for details. Dial.Call does not wait to see whether the call is answered, so you will need to include some code in your function that waits for the call to return a result before proceeding. The example script contains the following statements to do this:
While ((IVRCall.State <> 2) And (IVRCall.State <> 3))
  Sleep(100)
End While
This waits in periods of 100 milliseconds until a connection or failure occurs.
See also
‘Writing an IVR hand-off function’ on page 1121