Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Interactive Voice Response interviews > Writing an IVR hand-off function
 
Writing an IVR hand-off function
To conduct IVR interviews, your UNICOM Intelligence Interviewer - Server script needs to perform the following tasks:
Dial the IVR system and pass any relevant data from UNICOM Intelligence Interviewer - Server to IVR. Typically, you will pass at least a respondent identification code to link the UNICOM Intelligence Interviewer - Server and IVR data.
Connect the respondent to the IVR system ready to start the automated portion of the interview.
The simplest way to do this is to write a function. Here is a simple example that you can adapt to suit your company's requirements. It uses the SPSS Dialer methods that are available on the _Dialer and _Extension objects. For IVR information, see your dialer’s documentation.
Function TransferToIVR(IOM, _Dialer, _Extension)
Const IVR_NO = "02071234567"
Const SAMPKEY = "ID"

Dim DTMF, IVRCall
' The DTMF to the IVR system consists of the sample record ID
' and a # symbol requesting IVR to start the interview
DTMF = IOM.SampleRecord[SAMPKEY] + "#"

' Dial the IVR system with a 5 second time-out and send the
' DTMF tone when it connects
Set IVRCall = _Dialer.Groups["ivr_xfer"].DialCall(IVR_NO, , , , 5, , DTMF)

' Wait for the call to connect (2) or terminate (3)
While ((IVRCall.State <> 2) And (IVRCall.State <> 3))
Sleep(100)
End While

If (IVRCall.State = 2) Then
' Connection made. Transfer the call.
QsampExtension.Call.TransferToExtension(IVRCall.Extension.SlaveExtension)
' Wait until the transfer of the original call is complete (and it terminates (3))
While (_Extension.Call.State <> 3)
Sleep(20)
End While
TransferToIVR = True
Else
' No connection - something went wrong.
TransferToIVR = False
End If
End Function
See also
Dialing the IVR system
Passing information to the IVR system
Transferring the respondent to IVR
Dealing with failed calls
Interactive Voice Response interviews