Creating the interaction
Now we will develop the interaction between the Call Engine and the VB ActiveX application. All of the
work will be performed in this example by the VB ActiveX application. Much of the prompt control could
be handled by the project instead. With no code developed the current call behavior is:
- Call is answered by Call Engine.
- Call start event is raised in the DefaultModule class
- Call enters "Start" module. It is directed to the "zip code" module.
- Call Enter Module event is raised in the DefaultModule class
- Call enters the "Zip Code" module. Call fails because no audio, handlers or grammars have been added.
The first thing we need to add is the zip prompt. This can be done by adding the line:
LVCA.AddLibraryPrompt "ZIP Main"
into the Enter Module event in the DefaultModule class. We also need to add the grammar for the zip code.
We will use the built in grammar for digits. Add the following lines:
- LVCA.LoadSRGSGrammar "ZipCode", "Builtin:grammar/digits", false
- LVCA.ActivateSRGSGrammar "ZipCode", false
This is the minimum required to start the interaction. Now we will need to handle the results of the interaction.
The first thing to check is what happen. This can be done with the following line in the After Decode event.
- Dim concept As String
- LVCA.GetInteractionCondition
If this equals the LVCAIC_NOMATCH we will add the library prompt "ZIP no match". Likewise if it
equals LVCAIC_NOINPUT add the "ZIP no input" prompt. After these prompts are added we can exit the
sub and the call will loop around and raise the Enter Module again. This is because we did not direct the call,
we only added a prompt. Add the following lines of code
- If LVCA.GetInteractionCondition = LVCAIC_NOINPUT Then LVCA.AddLibraryPrompt "ZIP no input"
- If LVCA.GetInteractionCondition = LVCAIC_NOMATCH Then LVCA.AddLibraryPrompt "ZIP no match"
If the LVCA.GetInteractionCondition equals LVCAIC_MATCH then we can capture the result by calling:
- If LVCA.GetInteractionCondition = LVCAIC_MATCH then
- concept = LVCA.GetSemanticInterpretationString(0, INTSTR_CONTENT)
Now that we have the semantic interpretation of the callers audio we can evaluate where the call flow needs
to be directed. For this example we will just play it back with the TTS engine with the following:
- LVCA.AddTTSPrompt concept
- LVCA.AddLibraryPrompt "ZIP end"
- LVCA.DoHangup
- End If