The Call.invokeVoiceXML2() method allows you to invoke a VoiceXML 2.1 application from a Java application.
It is easy to create a dialog with the caller using VoiceXML, but there are currently some things you cannot do from VoiceXML because the VoiceXML specification does not support them. For example, you can't make an outbound call from a VoiceXML dialog. To augment the capabilities of VoiceXML, you can create a Java application that makes the outbound call and then invokes the Call.invokeVoiceXML2() method to transfer control to a VoiceXML application dialog. At the end of the dialog, you return control to the Java application.
<exit expr=”response” />
The value passed using the expr= attribute is returned by the Call.invokeVoiceXML2() method as an object when the method has finished executing.
try { // Invoke a VoiceXML application and transfer data Object appData = new Object(); call.invokeVoiceXML2("\\http:\mydir\myapp.vxml",appData); }
This gives you the start of a generic outbound calling solution where the Web or application server not only delivers the VoiceXML pages to the browser but controls the outbound dialing numbers. You can then extend this further to deal with errors such as no answer, fax or answering machine detection, and so on.
For performance reasons you should always run Java applications that invoke VoiceXML applications within a node: in other words, you must define the Java application in an AppName entry in the default.cff configuration file.