Example IVR script
The following script brings together all the information provided in the other topics in this section, and is ideal for use as a test script. It is installed as part of the UNICOM Intelligence Developer Documentation Library,:
[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\Interview\Documentation\ivr.mdd
The metadata section defines some initial screening questions to select respondents for the IVR interview, and an error message for the interviewer in case the call or transfer to IVR fails.
' Questions to pass to IVR
UsedEver "Have you ever used breath fresheners on a regular basis?"
categorical [1..1] {Yes, No};
UseNow "And are you using a breath freshener regularly now?"
categorical [1..1] {Yes, No};
WeeklyUsage "How many times a week do/did you use a breath freshener?"
long [1..99];
Type "Which type of breath freshener do you mainly use or have you mainly
used in the past" categorical [1..1]
{
Spray, Mouthwash, Tablets, Gum, Other
};
Ivrchk "The rest of the interview will be conducted as an automated
survey. A machine will ask the questions, and you can answer by typing
numbers on your telephone keypad.<br/>
Are you willing to be interviewed in this way?"
categorical [1..1]
{Yes, No};
Handoff "Thank you for your help. You are now being transferred to
the automated system." info;
ErrMsg "There is a technical problem and the interview cannot continue.
Thank you for your help.
INTERVIEWER: Failure due to : {ErrorDescription}" info;
NotSuitable "This survey requires people who have used or who now
use mouthwash so you are not suitable for this survey.
Thank you for your help." info;
Thanks "Thank you for your help." info;
The routing section asks the screening questions, calls the IVR system and, if the call is successful transfers the respondent to the IVR system ready to continue the interview.
UsedEver.Ask()
UseNow.Ask()
If UsedEver = {No} And UseNow = {No} Then
NotSuitable.Show()
IOM.Terminate(Signals.sigCompleted, , TerminateStatus.tsCompleted)
End If
WeeklyUsage.Ask()
Type.Ask()
Ivrchk.Ask()
If Ivrchk = {Yes} Then
Handoff.Show()
If TransferToIVR(IOM, QSampDialer, QSampExtension) Then
' Transfer succeeded so terminate the interview and flag as
' Complete.
IOM.Terminate(Signals.sigCompleted, , TerminateStatus.tsCompleted)
Else
' Unable to transfer the call so terminate interview and
' flag as Terminated
ErrMsg.Show()
IOM.Terminate(Signals.sigError)
End If
Else
Thanks.Show()
End If
Function TransferToIVR(IOM, QSampDialer, QSampExtension)
' Transfer the call to the IVR system
Const IVR_NO = "02071234567"
Dim DTMF, IVRCall
On Error Goto DialerError
' The DTMF to the IVR system consists of the respondent serial
' number and the answers to the questions in the metadata section.
DTMF = CText(IOM.Info.RespondentID) + "#" + _
PrepareQ(IOM.Questions["UsedEver"]) + _
PrepareQ(IOM.Questions["UseNow"]) + _
PrepareQ(IOM.Questions["WeeklyUsage"]) + "#" + _
PrepareQ(IOM.Questions["Type"]) + "#"
' Dial the IVR system with a 5 second time-out and send the
' DTMF tone when it connects
Set IVRCall = _
QsampDialer.Groups["ivr_xfer"].DialCall(IVR_NO, , , , 5, , , DTMF)
' Wait until the call is connected (2) or terminates (3)
While ((IVRCall.State <> 2) And (IVRCall.State <> 3))
Sleep(100)
End While
If (IVRCall.State = 2) Then
' The call connected to the IVR system. Transfer the call.
QsampExtension.Call.TransferToExtension(IVRCall.Extension.SlaveExtension)
Else
' The call terminated - something went wrong.
Err.Raise(-1, "", GetOutcomeDescription(IVRCall.Outcome))
End If
' Wait until the transfer of the original call is complete
' (and it terminates (3))
While (QsampExtension.Call.State <> 3)
Sleep(20)
End While
TransferToIVR = True
Exit
DialerError:
IOM.Questions["ErrMsg"].Label.Inserts["ErrorDescription"] = Err.Description
TransferToIVR = False
End Function
Function PrepareQ(Question)
If Question.QuestionDataType = DataTypeConstants.mtCategorical Then
PrepareQ = CText(Question.DefinedCategories().Find(Question))
Else
PrepareQ = CText(Question)
End If
End Function
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 2
GetOutcomeDescription = "The number dialed was out of order."
Case 3
GetOutcomeDescription = "The call failed due to an internal dialer error."
Case 4
GetOutcomeDescription = "The call was rejected by the remote party."
Case 5
GetOutcomeDescription = "The number has changed, i.e., the remote party is now contactable using a different number."
Case 6
GetOutcomeDescription = "The number was incomplete (the call never rang)."
Case 7
GetOutcomeDescription = "No trunks were available to make the call."
Case 8
GetOutcomeDescription = "Network congestion prevented the call from being dialed."
Case 9
GetOutcomeDescription = "The number dialed was busy."
Case 10
GetOutcomeDescription = " A fast-busy tone was detected. This normally indicates network congestion but some
networks use this to indicate an unallocated number. "
Case 11
GetOutcomeDescription = "A tri-tone tone was detected. "
Case 12
GetOutcomeDescription = "A recorded announcement was detected."
Case 13
GetOutcomeDescription = "The call was not answered within the no-answer time-out period."
Case 14
GetOutcomeDescription = "A group call was dialed but no suitably qualified extension was available to accept the call."
Case 15
GetOutcomeDescription = "The extension was on-hook."
Case 16
GetOutcomeDescription = "The call was transferred to another extension or group."
Case 17
GetOutcomeDescription = "The call was hung up locally by the dialer"
Case 18
GetOutcomeDescription = "The call was hung up remotely"
Case 19
GetOutcomeDescription = "No DSPs were available on the dialer. This is a special case of coNoResources."
Case 20
GetOutcomeDescription = "The dialer has insufficient resources available to make the call."
Case 21
GetOutcomeDescription = "The call terminated and the dialer couldn't determine why."
Case 22
GetOutcomeDescription = "The number is a fax or modem."
End Select
End Function
See also