| How can I change an element's settings dynamically at runtime? |
| Categories: Audium OpenSDK |
| Article ID: | 133 |
| Last updated: | January 08, 2007 |
| User Opinions |
|
No users have voted.
|
|
Thank you for rating this answer.
|
SUMMARY
This article explains how to change the values of an element's settings dynamically at runtime.
SYMPTOMS
Developer would like to change the settings of an element at runtime, for example changing the number that a Transfer element transfers to based on the caller's input at runtime.
RESOLUTION
There are two ways to modify settings dynamically at runtime:
Using Substitution
Substitution can be used to insert placeholder strings that will evaluate to real data at runtime. For example, if you insert a substitution into a Transfer element's destination setting, you can pull the telephone number from either element or session data at runtime. Note that this approach generally requires that another element perform the task of creating the element or session data that will be substituted. A common example is as follows:
1) An Action element retrieves a telephone number from a database and stores it in element data 2) Next, a Transfer element has a substitution in its destination setting, which dynamically inserts the telephone number that was stored by the Action element in step 1 3) The caller is transferred to the desired telephone number
For more information about how substitution works, and how to use the Substitution Tag Builder please refer to the built-in help files that come with Audium Studio (from the Help menu choose Help Contents). A search for "substitution" will bring you to the correct section. Additionally, the Receptionist tutorial application is a useful resource, since it walks you through the process of using substitution.
Using a Dynamic Configuration
A Java class can be created that will dynamically configure an element at runtime. If you choose this solution, you can bundle the logic and back-end integration that acquires data with the act of setting the data in the element (in comparison to substitution, which requires that a separate element be used to acquire and store the data so that it can then be substituted).
The drawback to using dynamic configuration is that much of the activity is hidden from the callflow designer. Using substitution, even though the designer may not have created the Action element that retrieves and stores the data, the designer can see the element that does this in the callflow. However, if an element uses a dynamic configuration, only the element that will have its settings altered at runtime is needed, and the settings that will be changed are not immediately apparent to the designer. Therefore, the choice of substitution versus dynamic configuration is left up to the developer, as one approach may be more appropriate for the current project than the other.
For information about what is involved in creating a dynamic configuration class using Java, please refer to the Programmer Guide.
|
| Visitor Comments |
|
No visitor comments posted. Post a comment
|
| Related Questions |
|
No related questions were found.
|
| Attachments |
|
No attachments were found.
|