Showing 6 results.
Items per Page 50
of 1

CVP Forum

« Back to General Discussion - All Versions

Custom Java Classes with Call Studio

Combination View Flat View Tree View
Threads [ Previous | Next ]
 I am new to Custom Java and trying to learn it by using the templates in the Cisco site.Whats the best way to write custom java classes.
Is it better to use callstudio or some IDE like Eclipse. I feel like IDEs are more helpful for writing and fixing syntax errors.
For example if I want to use Eclipse as an IDE, do I need to add any audium files to it before start using import commands in the java code?
 
 

Call studio is based off eclipse and has the IDE built in. So you can same the same studio to write java code. You can use the java perspective from the studio. You can write code in separate eclipse too as there are advanced eclipse version with added features and built in plugins. Since you are just starting, I would just suggest using Studio as it has pretty much everything you need to write your java code.
Hemal

From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Thursday, February 14, 2013 11:59 AM
To: cdicuser@developer.cisco.com
Subject: New Message from Mark Applebee in Customer Voice Portal (CVP) - General Discussion - All Versions: Custom Java Classes with Call Studio

Mark Applebee has created a new message in the forum "General Discussion - All Versions": -------------------------------------------------------------- I am new to Custom Java and trying to learn it by using the templates in the Cisco site.Whats the best way to write custom java classes.
Is it better to use callstudio or some IDE like Eclipse. I feel like IDEs are more helpful for writing and fixing syntax errors.
For example if I want to use Eclipse as an IDE, do I need to add any audium files to it before start using import commands in the java code?


--
To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/11939383 or simply reply to this email.

Personally, I feel it's easier to get started by using Studio/Eclipse because, as you say, it'll provide intellisense and suggest corrections. It usually does auto-compile and then to test your java class, you can simply copy the compiled java .class file into your Studio application and put it under appname/deploy/java/application/classes. If the code creates a new element (or say it smart), then close the Studio application from the workspace and re-open it by double-clicking app.callflow and the new element will appear under Elements/Local Elements.
 
To create the Java project, select New/Project/JavaProject/ Enter a name for your Java project and click 'Next'.
Then in the wizard, click on the Libraries tab and click 'Add External Jars' - you'll need to select  'framework.jar', 'servlet.jar' (was called servlet2.3.jar until cvp 9), and if you're extending existing studio elements you'll need 'elements.jar' - do a Search ahead of time, these files are all in the Studio/eclipse/plugins folder somewhere.
Then copy some of the Cisco examples into your Java project. Eclipse will compile. You can then copy the compiled class files into your Studio application and test them (as described above).
 
 
 
 
 
 
 
Mark Applebee:
 I am new to Custom Java and trying to learn it by using the templates in the Cisco site.Whats the best way to write custom java classes.
Is it better to use callstudio or some IDE like Eclipse. I feel like IDEs are more helpful for writing and fixing syntax errors.
For example if I want to use Eclipse as an IDE, do I need to add any audium files to it before start using import commands in the java code?
 
 

Thanks Janine,this is really helpful!

Janine..as you descrbied above, I managed to create a class file using one of the template in the developer forum. Then I copied the class file into appname/deploy/java/application/classe folder and restarted the app as you mentioned. But the file is not appearing in local elements. I am using call studio version 8.5 and JDK is 1.7. Do I need to use JDK 1.6 or is it some other issue?

Do you have anything showing in your Call Studio Error Log? If the element is failing to load, an error or warning should be displayed there.

>>>>Do you have anything showing in your Call Studio Error Log? If the element is failing to load, an error or warning should be displayed there.

In my experience, a much better place to look is in the Tomcat logs.

Regards,
Geoff
.

Assuming the class is compiled correctly and there are no errors, I would bundle it into jar and deploy it under the lib dir. JDK is not an issue.
Hemal

From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Thursday, February 28, 2013 12:00 PM
To: cdicuser@developer.cisco.com
Subject: New Message from Mark Applebee in Customer Voice Portal (CVP) - General Discussion - All Versions: RE: Custom Java Classes with Call Studio

Mark Applebee has created a new message in the forum "General Discussion - All Versions": -------------------------------------------------------------- Janine..as you descrbied above, I managed to create a class file using one of the template in the developer forum. Then I copied the class file into appname/deploy/java/application/classe folder and restarted the app as you mentioned. But the file is not appearing in local elements. I am using call studio version 8.5 and JDK is 1.7. Do I need to use JDK 1.6 or is it some other issue?
--
To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/12485582 or simply reply to this email.

Sorry , not sure if JDK 1.7 is supported with CVP Studio 8.5. Confirming that. Use 1.6 and compile with that.
Hemal

From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Thursday, February 28, 2013 12:00 PM
To: cdicuser@developer.cisco.com
Subject: New Message from Mark Applebee in Customer Voice Portal (CVP) - General Discussion - All Versions: RE: Custom Java Classes with Call Studio

Mark Applebee has created a new message in the forum "General Discussion - All Versions": -------------------------------------------------------------- Janine..as you descrbied above, I managed to create a class file using one of the template in the developer forum. Then I copied the class file into appname/deploy/java/application/classe folder and restarted the app as you mentioned. But the file is not appearing in local elements. I am using call studio version 8.5 and JDK is 1.7. Do I need to use JDK 1.6 or is it some other issue?
--
To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/12485582 or simply reply to this email.

The JDK compliance on 8.5 extends to only 6 only. I would therefore first compile with 1.6 and make sure that there are no errors.
Hemal

From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
Sent: Thursday, February 28, 2013 12:00 PM
To: cdicuser@developer.cisco.com
Subject: New Message from Mark Applebee in Customer Voice Portal (CVP) - General Discussion - All Versions: RE: Custom Java Classes with Call Studio

Mark Applebee has created a new message in the forum "General Discussion - All Versions": -------------------------------------------------------------- Janine..as you descrbied above, I managed to create a class file using one of the template in the developer forum. Then I copied the class file into appname/deploy/java/application/classe folder and restarted the app as you mentioned. But the file is not appearing in local elements. I am using call studio version 8.5 and JDK is 1.7. Do I need to use JDK 1.6 or is it some other issue?
--
To respond to this post, please click the following link: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/12485582 or simply reply to this email.

Once you close the app out of the Studio workspace, and then
double-click app.callflow, the element should show up under Local
Elements. If it doesn't then there's usually an array indexing problem
in your java code.

In Studio, look under Window > Show View > Call Studio Error Log. This
will display at the bottom of the Studio window, near the Studio
Problems tab. You should select the error, and right-click, select
Properties. This will pop up a box and give you an error message and
Java stack trace.

Usually the error is in the method named GetSettings or GetElementData
or GetExitStates. Each of these has an array. You must specify the size
of the array. And then you MUST initialize each row of the array.

If you either fail to initialize one of the array rows, or if you
initialize a row of the array but the array dimension is smaller than
that (indexOutOfBounds) then the element will fail to show up in the
Studio pane.

Feel free to post your java file online and I'll fix it for you.

This is my first Java code. I was trying to use a template posted by you. Here it is:
 
import com.audium.server.AudiumException;
import com.audium.server.voiceElement.ActionElementBase;
import com.audium.server.session.ActionElementData;
 
public class TEST1 extends ActionElementBase
{
public void doAction(String name, ActionElementData data) throws AudiumException
{
String callid=(String)data.getSessionData("callid");
data.addToLog("callid",callid);
data.setElementData("LANG","ENG");
}
 
}
 
Please let me know whether I am doing it right.

This is a 'Standard Action' - it doesn't show up as a new element in
Studio.

To use this code, you drag in the Studio element named 'Action'. You can
then name the element in Studio if you like.

In the right side, configuration pane, enter the Java class name
(without a file extension) - 'TEST1' (omit the quotes).

That's all.

Janine

Mark Applebee:
This is my first Java code. I was trying to use a template posted by you. Here it is:
 
import com.audium.server.AudiumException;
import com.audium.server.voiceElement.ActionElementBase;
import com.audium.server.session.ActionElementData;
 
public class TEST1 extends ActionElementBase
{
public void doAction(String name, ActionElementData data) throws AudiumException
{
String callid=(String)data.getSessionData("callid");
data.addToLog("callid",callid);
data.setElementData("LANG","ENG");
}
 
}
 
Please let me know whether I am doing it right.

 
Hi Mark
For the audium element to show up in the studio, you will have to implement the ElementInterface in your class.  Apart from CVP programming guide, you will also need the javadoc for CVP API. You can download some sample custom elements and the javadocs from http://developer.cisco.com/web/cvp/home 
Regards
Birendra Hansda