cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4137
Views
0
Helpful
13
Replies

CVP using action element

alexey-burov
Level 1
Level 1

Hi all.

I'd like to use action element in my CVP script to make data base lookup and other actions.
I have a class which performs all that i need.
CallStudio Action element has one field where a class name should be placed.
Can you tell me where should i place my class ? Is there Any other settings that i should accomplish before i can use it?

13 Replies 13

geoff
Level 10
Level 10

You code your action element using the template as a guide (see attached). You may have a class that does what you need, but unless it is of the correct form, it will not be useable.

You pass configuration data to the action element using the Setting[] array, often by Substitution.

All your code lives in the method

public void doAction(String name, ActionElementData data) throws ElementException

Don't use any static variables - code for multiple threads and re-entrancy.

Once you have compiled your element, put it in the correct place in the CVP Studio file system and start up Studio - you will see your element under the folder name set in the method

public String getDisplayFolderName().

Drag your element onto the app, configure the settings and away you go. Put the class on the server in \Cisco\CVP\VXMLServer\common\classes and either restart the server or call updateCommonClasses.bat. Deploy the app and make a test call.

I'm not sure I understand what you mean by this:

CallStudio Action element has one field where a class name should be placed.

The Developer's Guide explains the required technique.

Regards,

Geoff

Thanks for your reply!

You have described the way to make custom action element. It is very useful.

Also I'd like to know how can i use standart action element.  It has tab - "Element configuration" and a field to fill with class name(see attached). My question was about this.

You wrote " Once you have compiled your element, put it in the correct place in the CVP Studio file syste..."

plugins\com.audiumcorp.studio.library.common_6.0.1\classes - is this place correct?

i had an attempt to build custom element following your instructions.

I  made a class with example code took from this forum(see attach).

i put the class under eclipse\plugins\com.audiumcorp.studio.library.common_6.0.1\classes  folder

i put the jar     under eclipse\plugins\com.audiumcorp.studio.library.common_6.0.1\lib          folder

After restart CallStudio no element appears under elements folder.

After that i put the class and jar file under deploy/java folder  but no elements appears under Local Elements folder.

I'm using trial version of Call Studio now. Do this cause the problem?

You are on the right track. No need to make a JAR - just put the class in the common\classes folder.

If the element does not appear in "MyTESTfolder" it could be because it does not get loaded correctly.

I would first try with the shell I showed you - with no real code in it. Just to be sure of the technique.

Regards,

Geoff

It doesn't work.

i put the template that you gave me with no change to methods and no elements appear.

I attempted to put .java file, next time  .class file but nothing changed next time - both, but nothing changed.

Is there any log where i can see the problem?

Hey,

there is another simple way. You build your class according to the template Geoff posted. You compile your Class using your java compiler, so you get your .class file. Then you drag this .class into your StudioProject under Project->deploy->java->application->classes and put the name of your class file without the .class (if your class is "HelloWorld.class", put in "HelloWorld") into the Action Element Class Field you showed on your screenshot.

Now your class will be executed when you run this application and you can use sessions to pass your data back to your app:

In Java Code:

data.setSessionData("StringName", value);

In Subdialog Return:


{Data.Session.StringName}

Thats the way i do it. I don't know if there is something wrong with this way, but its very easy and works great! Dont forget to re-deploy or update your application on the VXML Server if you override it during tests.

~Fabian

There are essentially two ways:

1. You build a custom class as a reusable component and place your class file in plugins\common\classes and restart Studio. The element appears under the folder name among all the predefined elements. You can drag it onto the designer, configure data to pass to the settings and so on. Deploy the class on the server in common\classes.

2. You code as Fabian explained. This is when you don't anticipate reusing it. This is "in line" Java coding for the application. The element is "hidden" in a way, and it's not that obvious in the application.

I always use the first method, even when I don't use it more than once in the application. I find it gives me more visibility into what's happening. Just a matter of personal taste.

For complex classes I build a parallel class I can execute stand-alone from the command line, with a method that does what I want it to do. Once fully tested from the command line, passing arguments from the command line through to my method, I copy that method into the custom action element.

Now it is getting arguments from the application through settings and the doAction() method which call my method that does the heavy lifting. Otherwise it's hard to test.

Anyway, compiling the simple template, putting it in place, and restarting Studio MUST show the element among the predefined elements. If it cannot load the class, which it does not really execute but it must load and must be seen through Java reflection, then it does not appear. A mistake in the class will make it not appear. There is logging - you can see the log in Studio. From Help, there is a button to show the startup log. Look in there for an error.

I don't know why the simple template does not work for you. It should - and you do need to figure out what you are doing wrong.

Regards,

Geoff

I have a few question more.

Can the trial version of CallStudio be the cause of that problem that i can't see custom elements?

Do I need to put custom class some where at vxml server in both cases: custom element for all application and custom class for using at standart action element(Fabian variant)?

If i should put that class at vxml server do i neet to restart it each time i modify the class?

Hi,

a can only answer for my way, since i have no expirience with Geoff's way. If you drag the class into the studio project like i said and deploy it. then you get your application folder which you place unter Cisco\CVP\VXMLServer\applications\

You will find your class in your appfolder under java\application\classes. If you have any aditional libs your class needs put it under java\application\lib or Cisco\CVP\VXMLServer\tomcat\common\lib (counts for all your apps).

Everytime your change something in your .class file and override it you have to update your application (appfolder\admin\updateApp.bat).

~Fabian

Can the trial version of CallStudio be the cause of that problem that i can't see custom elements?

Nope.

Do I need to put custom class some where at vxml server in both cases: custom element for all application and custom class for using at standart action element(Fabian variant)?

If i should put that class at vxml server do i neet to restart it each time i modify the class?

If you build a reusable component it must be placed on the server in VXMLServer\common\classes. You either restart the VXMLServer or call updateCommonClasses.bat from VXMLServer\admin.

Regards,

Geoff

Many thanks!

I solve this problem.

I was using JDK 1.6 for compiling my custom class. It was wrong. The right version is JDK 1.5

That's for sure. Your build environment must match the Apache Tomcat run environment. I'm glad you sorted it out.

A tricky bug and thanks for the update - perhaps someone else will profit from this thread.

Regards,

Geoff