cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
54
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: null on 04-03-2004 03:07:51 PM
I need to build an action element that simply multiplies two numbers (inputs from the user) together and returns the result. I am not a programmer don't know how to create this element. Do you have any advice on how to accomplish this task? Are there generic action elements for this purpose?

Thanks,

Anil

Subject: RE: Building Action elements
Replied by: Michael Bochynski on 05-03-2004 07:32:13 PM
Hi Anil,

There are several ways to do this type of task in Audium.

The most convenient method for a simple calculation is to creating a Java class that you will reference using a generic Action element in the Builder.

By using a generic Action element you only have to provide the code for computations. Other methods would require more programming.

To create the code you will need to use the Java API to write a Java class
that you will compile in the Java IDE of your choice. Once compiled, put the Java class in the directoy: "../[Audium Home]/[Applicaton Name]/java/application/classes" and you will be able to reference the class name with any action element.

For your reference, I've provided a specific example that gathers the caller's inputs from two Number elements (in this case named Number01 and Number02 -- you will need to change the names to match the element names in your application) and sets the result of the computations as element data for this Action element, thus available throughout the call flow.

[code:1:0e798a3a2e]
import com.audium.server.AudiumException;
import com.audium.server.session.ActionElementData;
import com.audium.server.voiceElement.ActionElementBase;

public void doAction(String arg0, ActionElementData element)
throws AudiumException {
String argument1 = element.getElementData(â¿¿Number01â¿¿,â¿¿valueâ¿¿);
String argument2 = element.getElementData(â¿¿Number02â¿¿,â¿¿valueâ¿¿);
int sum = Integer.parseInt(argument1) + Integer.parseInt(argument2);
element.setElementData(â¿¿valueâ¿¿, Integer.toString(result));

}
[/code:1:0e798a3a2e]

For the detailed description of using the Audium Java API please refer to the Programmers Guide.
Regards,
Michael

Subject: RE: Building Action elements
Replied by: Michael Bochynski on 05-03-2004 08:38:17 PM
Hi Anil,

Please find my updated answer here

Regards,
Michael

Subject: RE: Building Action elements
Replied by: null on 09-03-2004 12:50:17 AM
Michael,

Thanks for the help,

Anil
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links