Jump to: navigation, search

Hello World Sample

Here is a simple voice application to help you get started with Composer. This application says Hello World when the call is answered.

Simple Text-to-Speech Application

To build a simple text-to-speech (TTS) application that says Hello World to the caller:

  1. Create a new Composer Project called Hello World.
  2. Add the following blocks from the Basic Blocks Palette to the canvas area:  Entry, Prompt, and Exit, then connect them with Output Links.
  3. Select the Entry block, or right-click the Entry block and select Show Properties View from the shortcut menu, if you want to set any properties (optional).
  4. Select the Prompt block, or right-click the Prompt block and select Show Properties View from the shortcut menu.
  5. Select the Name property and type a name in the Value field.
  6. Select the Prompts property and click the OpenDialogBoxButton.gif button.
  7. Click the Add button and type a name in the Name field (optional).
  8. Select Value in the Type drop-down list (default).
  9. Select Text in the Interpret-As drop-down list (default).
  10. Type HelloWorld (one word) in the Value field.
  11. Click OK.
  12. Save the file by selecting File > Save. You will not be able to generate code if you do not save the file.
  1. Generate the code by selecting Diagram > Generate Code, or by clicking the Generate Code icon Generate code icon.gif on the upper-right of the Composer main window when the callflow canvas is selected.
  2. If you get any errors, double-click on the error to get the details and fix the problem. For the Hello World application, typical problems would be forgetting to add the Hello World prompt or forgetting to link the blocks together.
  3. If code generation succeeds, click OK at the confirmation dialog box.
  4. Make sure the project is deployed for testing. Composer bundles Tomcat for running test applications. If you configured the Tomcat settings prior to creating your Composer Project, it will be auto-deployed on the Tomcat Server. You can double check this by clicking on the name of the project in the Project Explorer, then right-click and select Project Properties. Select the Tomcat deployment category and verify that the project is deployed. If not, click Deploy.
  5. Select the callflow in the Project callflows folder.
  6. Run the application by selecting  Run > Run As > Run Callflow, or by right-clicking on the callflow file name in the Project Explorer and selecting Run As > Run Callflow.

The code is generated in the src-gen folder and the GVP debugger sends the call to your SIP Phone.

  1. Accept the call and you will be connected to the application on GVP. The call traces will become visible in the Call Trace view, and you should hear Hello World played through the phone.

Adding Blocks

There are a few ways to add blocks from the Palette to the canvas. The most common methods are as follows:

  • Click on the block icon on the palette, release the mouse and click on the target location on the canvas area.
  • Double-click a block icon on the palette.
  • Click on the block icon on the palette, and while holding down the mouse button, drag and drop the block to the canvas.

Any of these methods will add the new block and you can then type the name of the block on the canvas itself. Click here to read about block naming restrictions.

Connecting Blocks

Blocks are connected to each other using connection links. There are two types of connection links:

  • Output Links used to connect one block's output port to another block's input port, and
  • Exception Links used to indicate error or exception conditions by connecting from a block's exception port to another block's input port.

 To add a new Output Link (or Exception Link):

  1. Click the Output Link (or Exception Link) icon in the palette.
  2. Move the mouse over to the source block. The cursor will change to an upward arrow.
  3. Click once on the source block and keep the mouse button pressed. Then drag the mouse onto the target block and release the mouse button.

This will add the connection link between the two blocks. To use an Exception Link, the source block must have an exception port defined. This is done by selecting at least one supported exception within the block's Exceptions property.

Another method for adding an Output Link or Exception Link between two blocks is as follows:

  1. Click once on the source block to select it.
  2. Hold the Ctrl key and click once on the target block to select it as well.
  3. Double-click the Output Link (or Exception Link) icon in the palette to create a connection between the two blocks.

Again, to use an Exception Link, the source block must have an exception port defined.

The preference Show Connection Ports (in Composer DiagramPreferences) affects how connection links can be drawn to connect blocks. If it is switched on, links may be drawn directly by dragging from an outport of a block and dropped onto a block or its inport. This method will work in addition to using the Output link and Exception link tools. If the setting is switched off, connection ports are not displayed and therefore the method of drawing links mentioned above is not available.

Comment on this article:

blog comments powered by Disqus
This page was last modified on 11 October 2016, at 09:21.