Skip to main content

Best Practices

Working with container applications is straightforward, but if not following a well-formed process - can rapidly turn into an ill-managed source code fiasco. When working with container applications, try to keep to the following guidelines.

Building Blocks

main block

When a container application is created, it will always include a main block. This block is the default entry point to any container application (similar to the int main(void) function in C or C++). This is invaluable, as long as the number of blocks your application has is small. When a container application has multiple blocks, we recommend creating a new block for your application entry point, and not use the main block.

Thus, we recommend that for the main block, you use the following configuration:

main block -  STATIC RUNTIME

<Response>
<Hangup />
</Response>

The above static code will ensure that if the main block is activated by any chance, the result will be and immediate hangup of the call.

Select blocks

As a best practice, we recommend defining your Select blocks before all other blocks. A Select block is simply a set of select options and their corresponding container application blocks for execution. For example:

Select block -  SELECT RUNTIME

1:select_option_1
2:select_option_2
3:select_option_3
9:select_option_9

The Select block states that when the caller presses 1, execution will be transferred to the block called select_option_1, and so on.

Forward blocks

Forward blocks are used to transfer the call control execution to either a different block (as in a Select block), or to a remotely hosted CXML script via an HTTP/HTTPS webhook.

Forward block -  Forward RUNTIME

https://example.com/cxml/script