Creating the state table

To implement MRCP text-to-speech, you create a new state table using the Blueworx Voice Response State Table editor. Alternatively, you can create a state table using an ASCII editor and then import it to the Blueworx Voice Response State Table editor.

Figure 1 shows a completed state table for a simple MRCP text-to-speech application in a Blueworx Voice Response State Table editor window List View.

Note: Refer to the Blueworx Voice Response for AIX Blueworx Voice Response for AIX: Application Development using State Tables manual for general information on creating state tables.
Figure 1. Example state table for an MRCP text-to-speech application
Example state table for an MRCP text-to-speech application

To create a new state table application for MRCP text-to-speech using the Blueworx Voice Response State Table editor:

  1. Create the state table:
    1. From the Blueworx Voice Response Welcome window, select ApplicationsState Tables to display the State Tables window.
    2. Click FileNew. An empty State Table window is displayed:
      An empty State Table window
    3. Click ViewList View to display the state table as a list, as shown in the figures in this chapter.
  2. Define any entry points, input parameters, and local variables that you intend to use in your state table. For MRCP text-to-speech you need to specify:
    • A local string variable for defining TTS parameters.
    • A local string variable for holding the reason that the playing of the synthesized speech was ended.
    • A local string variable for the log identifier associated with all log information created for the session.
    • A local string variable to hold the text string to be synthesized or a URL reference.
    • A local numeric variable to hold the Session ID.
    • A local numeric variable to hold the return code.
  3. Establish a connection between the caller and Blueworx Voice Response for an incoming call:
    1. Select the AnswerCall icon in the PhoneLine folder of the Action Palette.
    2. Drag it to the work area.
    3. Configure the AnswerCall action. For more information on how to do this, refer to the “State table actions” chapter in the Blueworx Voice Response for AIX: Application Development using State Tables manual.
  4. Create the required parameter lists and text strings for TTS configuration.
    1. Select the AssignData icon in the Variable folder of the Action Palette and drag it to the work area.
    2. Click the Assign operator and select the PutTag parameter.
    3. Click Const for Operand 1.
    4. Type in the Operand 1 field an MRCP text-to-speech configuration parameter, for example the parameter speech-language.
    5. Click Const for Operand 2.
    6. Type in the Operand 2 field a valid value for the parameter in the Operand 1 field, for example, en-US.
    7. Click Result to display the Variables window.
    8. Click Local to display a list of previously defined local variables.
    9. Click the name of the tagged string variable to use for specifying speech synthesis parameters for the session, and click Select to save the information and close the window. (The current parameter = value pair is appended to the tagged string variable.)
    10. In the Action Assign Data window, type a meaningful description in the Description field to help you identify the Assign Data action.
    11. Click OK save the information and close the window.
    12. Repeat steps 4.a through 4.k for each of the other parameter = value pairs defining TTS parameters that you want to include in the tagged string for the TTS parameters. See Table 1 for details of possible speech synthesis parameters. You may need to adjust the values of these parameters to suit your synthesizer server.
  5. Connect with the MST custom server by using Host -> OpenHostServerLink
    1. To enable your application to establish a link with the MST custom server, select the OpenHostServerLink icon in the Host folder of the Action Palette and drag it to the position (in the List View) of the AnswerCall action in the state table. (The OpenHostServerLink action is added below it.) Configure the OpenHostServerLink action.
  6. Open a TTS session by using the MST_TTS_Assign state table.
    1. Double-click on the new InvokeStateTable action in the state table to display the Action InvokeStateTable window.
    2. Type MST_TTS_Assign in the State Label field.
    3. Type a meaningful description for the action in the Description field.
    4. Select the Invoke Direct radio button.
    5. Click on the State Table push button to display the State Table Selection window.
    6. Select MST_TTS_Assign from the list of available state tables displayed, and click on the OK push button to confirm your selection and close the window.
    7. Click on the Parameters push button to display the Invoke State Table Parameters window.
    8. Select the Const radio button for PARM1 and type in the field the name of the TTS engine to be used.
      Note: The name must match the type of an engine configured on an available TTS engine server for the TTS language and specified in the $CUR_DIR/ca/MST_dir/mst.xml configuration file.
    9. Click on the PARM2 push button to display the Variables window.
    10. Select the Local Variables radio button.
    11. Select the local variable for the TTS return code from the list of available local variables displayed, and click on the Select push button to confirm your selection and close the window. This variable is used to hold the numeric return code issued when the MST_TTS_Assign state table is invoked.
    12. Click on the PARM3 push button to display the Variables window.
    13. Select the Local Variables radio button.
    14. Select the local variable for the TTS session from the list of available local variables displayed, and click on the Select push button to confirm your selection and close the window. This variable is used to hold the numeric identifier of the MRCP speech synthesis session being started. It is assigned at runtime by the system.
    15. Click on the PARM4 push button to display the Variables window.
    16. Select the Local Variables radio button.
    17. Select the local variable for the TTS log identifier from the list of available local variables displayed, and click on the Select push button to confirm your selection and close the window. This variable is used to hold the string identifier that is associated with all log information that will be created for the MRCP speech synthesis session being started. It is assigned at runtime by the system.
    18. In the Action InvokeStateTable window, leave the field for Result 0 blank, but for each of the other possible Result State Transfer fields, type in the field the name of the label to use for the state table action that will handle such an error.
    19. Click on the OK push button to save your changes and close the window.
  7. You now need to deal with the return code issued when the MST_TTS_Assign state table is invoked. This involves switching to a state table action that ends the current MRCP speech synthesis session in the event of an error, or otherwise proceeding with the next action in the state table. To do this:
    1. Select the Case icon in the Variables folder of Action Palette and drag it to the position (in the List View) of the previous action in the state table.
    2. Double-click on the Case action in the state table to display the Action Case window.
    3. Type a meaningful description for the action in the Description field.
    4. Click on the Input Variable push button to display the Variables window.
    5. Select the Local Variables radio button.
    6. Select the local variable for the TTS return code from the list of available local variables displayed, and click on the Select push button to confirm your selection and close the window. This logs the numeric return code issued when an MST_TTS_Assign state table is invoked.
    7. For each possible return code (as documented in MST_TTS_Assign), type in the When field the numeric return code, and in the Goto field, the corresponding label of the action to which processing is redirected. Leave the Default field blank to ensure that if no errors are returned, processing continues with the next action in the state table.
    8. Close the Action Case window by selecting the Default field and pressing the Enter (Return) key.
      Note: You can define the state table actions that handle the error processing later, but you must use the Goto labels you have specified.
  8. Optionally, to override for this session the speech synthesis configuration parameters defined in the $CUR_DIR/ca/MST_dir/mst.xml configuration file, select the InvokeStateTable action, invoke the supplied state table MST_TTS_Config:
    1. Type MST_TTS_Config in the State Label field.
    2. Type a meaningful description for the action in the Description field.
    3. Select the Invoke Direct radio button.
    4. Click on the State Table push button to display the State Table Selection window.
    5. Select MST_TTS_Config from the list of available state tables displayed , and click on the OK push button to confirm your selection and close the window.
    6. From the Action InvokeStateTable window, click on the Parameters push button to display the Invoke State Table Parameters window.
    7. Click on the PARM1 push button to display the Variables window.
    8. Select the Local Variables radio button.
    9. Select the local variable for the TTS session ID from the list of available local variables displayed, and click Select to confirm your selection and close the window. This variable is used to hold the numeric identifier of the MRCP speech synthesis session being configured. It is assigned at runtime by the system.
    10. Click on the PARM2 push button to display the Variables window.
    11. Select the Local Variables radio button.
    12. Select the local variable for the TTS parameter string from the list of available local variables displayed, and click Select to confirm your selection and close the window. This variable was defined earlier in step 2 and is a tagged string including valid MRCP TTS configuration header fields to specify TTS session parameters.
    13. Click on the PARM3 push button to display the Variables window.
    14. Select the Local Variables radio button.
    15. Select the local variable for the TTS return code from the list of available local variables displayed, and click on the Select push button to confirm your selection and close the window. This variable is used to hold the numeric return code issued when the MST_TTS_Config state table is invoked.
  9. You now need to deal with the return code issued when the MST_TTS_Config state table is invoked. This involves switching to a state table action that ends the current MRCP speech synthesis session in the event of an error, or otherwise proceeding with the next action in the state table. See step 7 for details of how to do this. The possible return codes are documented in MST_TTS_Config.
  10. Synthesize speech by using the MST_TTS_Speak state table to ‘speak’ a text string or a text file. Using the InvokeStateTable action, invoke the supplied state table MST_TTS_Speak:
    1. From the Action InvokeStateTable window, click on the Parameters push button to display the Invoke State Table Parameters window.
    2. Click on the PARM1 push button to display the Variables window.
    3. Select the Local Variables radio button.
    4. Select the local variable for the TTS session ID from the list of available local variables displayed, and click Select to confirm your selection and close the window. This variable is used to hold the numeric identifier of the MRCP speech synthesis session being configured. It is assigned at runtime by the system.
    5. Select the Const radio button for PARM2, and type ascii-string to specify the format of the text to be synthesized. The string is automatically enclosed in MRCP ‘speak’ tags before being sent to the MRCP TTS server by the application.
    6. Click on the PARM3 push button to display the Variables window.
    7. Select the Local Variables radio button.
    8. Select the string that holds the prompt text to be synthesized.
    9. Click on the PARM4 push button to display the Variables window.
    10. Select the Local Variables radio button.
    11. Select the local string variable for defining TTS parameters from the list of available local variables displayed, and click Select to confirm your selection and close the window. This variable was defined earlier in step 2 and is a tagged string including valid MRCP TTS configuration header fields to specify TTS session parameters. If you wanted to override for this particular ‘speak’ action the parameters specified in the MST_TTS_Config state table you could do so by specifying a different tagged string.
    12. Select the Const radio button for PARM5, and type NONE to specify that the playing of synthesized text cannot be interrupted. If you are using text-to-speech instead of a recorded prompt you could use barge-in to interrupt it by specifying the available option:
      • ALL — to allow interruption by pressing any DTMF key
    13. Click on the PARM6 push button to display the Variables window.
    14. Select the Local Variables radio button.
    15. Select the local variable for the TTS return code from the list of available local variables displayed, and click on the Select push button to confirm your selection and close the window. This variable is used to hold the numeric return code issued when the MST_TTS_Speak state table is invoked.
    16. Click on the PARM7 push button to display the Variables window.
    17. Select the Local Variables radio button.
    18. Select the local variable for the TTS stop reason from the list of available local variables displayed, and click on the Select push button to confirm your selection and close the window. This variable is used to hold information returned from the server on why playing of synthesized speech was stopped.
  11. You now need to deal with the return code issued when the MST_TTS_Speak state table is invoked. This involves switching to a state table action that ends the current MRCP speech synthesis session in the event of an error, or otherwise proceeding with the next action in the state table. See step 7 for details of how to do this. The possible return codes are documented in MST_TTS_Speak.
  12. Free the TTS session by using the MST_TTS_Free state table.
    1. Double-click on the InvokeStateTable action in the state table to display the Action InvokeStateTable window.
    2. Type MST_TTS_Free in the State Label field.
    3. Type a meaningful description for the action in the Description field.
    4. Select the Invoke Direct radio button.
    5. Click on the State Table push button to display the State Table Selection window.
    6. Select MST_TTS_Free from the list of available state tables displayed, and click on the OK push button to confirm your selection and close the window.
    7. Click on the Parameters push button to display the Invoke State Table Parameters window.
    8. Specify local variables for each of the parameters, as follows:
      Parameter
      Value
      PARM1
      The local variable for the TTS session ID
      PARM2
      The local variable for the TTS return code
    9. In the Action InvokeStateTable window, for each of the Result State Transfer fields, type in the field the name of the label to use for the state table action that will handle such an error.
    10. Click on the OK push button to save your changes and close the window.
  13. Log any error condition that may occur when the state table application is run. For each event that you want to log, select the LogEvent icon in the Miscellaneous folder of the Action Palette and drag it to the position (in the List View) of the InvokeStateTable action in the state table.
    1. Double-click on the LogEvent action in the state table to display the Action LogEvent window.
    2. Type a meaningful description in the Description field.
    3. Select the Const radio button for Private Event, and type a meaningful string to identify the type of error. Leave the System Event as an undefined variable.
    4. In each of the Result State Transfer fields, type the label of the state table action that will handle exit processing.
    5. Click on the OK push button to save your changes and close the window.
  14. Disconnect with the MST custom server by selecting the CloseHostServerLink icon in the Host folder of the Action Palette and draging it to the position (in the List View) of the previous action in the state table. This closes an open link with the MST Custom Server.
    1. Double-click on the CloseHostServerLink action in the state table to display the Action CloseHostServerLink window.
    2. Type a label name for the action in the State Label field.
    3. Type a meaningful description for the action in the Description field.
    4. Click on the Server Type push button to display the Server Type Selection window.
    5. Select Custom Server from the list displayed, and click on the OK push button to confirm your selection and close the window.
    6. Click on the Server Name push button to display the Servers Selection window.
    7. Select MST from the list displayed, and click on the OK push button to confirm your selection and close the window.
    8. Click on the OK push button to save your changes and close the window.
  15. To enable your application to exit from the state table, select the ExitStateTable icon in the StateTable folder of the Action Palette and drag it to the position (in the List View) of the previous action in the state table.
    1. Double-click on the ExitStateTable action in the state table to display the Action ExitStateTable window.
    2. Type a label name for the action in the State Label field.
    3. Select a value of 0 to return to the calling InvokeStateTable action.
    4. Click on the OK push button to save your changes and close the window.
  16. Close the connection between the caller and Blueworx Voice Response.
  17. Terminate the application. Optionally, to terminate your application completely, freeing any allocated resources, hanging up any open telephone lines, and dropping all host sessions, select the CloseEverything icon in the Miscellaneous folder of the Action Palette and drag it to the position (in the List View) of the previous action in the state table.