06-05-2018 03:43 AM
Hello,
I am new on cisco call studio. I want to create one java custom code that calls rest service and want to use this code in cisco call studio application.Please let me know the steps for creating above scenerio. If you guys have some sample example or document it will be great
Thanks
06-05-2018 04:21 PM
If you don't want to use the out-the-box REST client element and want to go custom there's links here to a few examples that might help.
Watson integration
https://twitter.com/tindallpaul/status/869972206499049472
MediaSense
https://twitter.com/tindallpaul/status/740896459562713088
VoicePIN biometrics
https://twitter.com/tindallpaul/status/730145621965942784
Agent Request API
06-06-2018 08:38 AM
Hi Paul,
I want to use my custom java code as I am using Cisco call studio 10.5 and in 10.5 there is no REST client element present.
I also have one question, is there Cisco CVP required to run Java code on Cisco Call studio?
Right now i have only Cisco Call studio.
If Cisco CVP is required, then is there any other way I can create my Custom element only using Cisco Call Studio.
Thanks in advanced
06-06-2018 12:39 PM
CVP is not required to write and test java code for a studio app. You
can test it using the built-in Call Studio Debugger.
06-06-2018 01:44 PM
Can you please provide me a simple program and the steps to configure custom code in call studio.
Thanks
06-06-2018 04:24 PM
Build your own REST client Studio element as a custom Action or Decision element depending on whether you want one or multiple exit states. Use the samples I provided as a template to get started.
Develop your Java code in the development environment of your choice: you can use the CVP Studio Eclipse environment or something completely separate. My personal preference is to build custom Java code separately in Netbeans but it's really down to personal choice and which dev tools you prefer or are accustomed to. Whichever tool you use, build the custom element as a JAR and deploy it into two places. (10.5 Call Studio folder name may be slightly different from 11.x)
1. To add the custom element to Call Studio so it appears in the palette, drop the JAR into C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.library.common\lib
2. For the VoiceXML run-time environment, drop it into C:\Cisco\CVP\VXMLServer\common\lib
If you want to use the Studio debugger then the run-time location for your custom element is: C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.debug.runtime\AUDIUM_HOME\common\lib
06-06-2018 04:45 PM
Good advice. I have been adding my class files and lib jars directly to the project through the CS gui.
06-08-2018 11:09 AM
Hi Paul,
I am able to created my Custom element, thanks for your help.
In my custom code I am calling rest service which is "POST".
When I debug my application I am getting Error and I am not able to find any log as I am only using CiscoCall Studio.
I also check the logs in Windows -> Show View -> Call Studio Error Log, but not find any logs.
Where I can check the logs of my application?
Below is my code:
public class CallService extends ActionElementBase implements ElementInterface {
public String getElementName()
{
return "TestService";
}
public String getDisplayFolderName(){
return "ConService";
}
public String getDescription()
{
return "The elements created for calling Created Context store service";
}
public Setting[] getSettings() throws ElementException
{
Setting[] settingArray = new Setting[3];
settingArray[0] = new Setting("url",
"URL",
"This is the URL to call",
true,
true,
true,
Setting.STRING);
settingArray[1] = new Setting("resultType",
"Result Type",
"Choose where to store result \n" +
"into Element or Session data",
true,
true,
false,
new String[]{"Element","Session"});
settingArray[1].setDefaultValue("Element");
settingArray[2] = new Setting("resultName",
"Result Name",
"Name of variable to hold the result.",
true,
true,
true,
Setting.STRING);
settingArray[2].setDefaultValue("resultString");
return settingArray;
}
public ElementData[] getElementData() throws ElementException
{
return null;
}
@Override
public void doAction(String name, ActionElementData actionData) throws Exception {
// TODO Auto-generated method stub
ActionElementConfig config = actionData.getActionElementConfig();
String url = config.getSettingValue("url",actionData);
String resultType = config.getSettingValue("resultType",actionData);
String resultName = config.getSettingValue("resultName",actionData);
try {
String responseBody = getUrl(url);
if(resultType.equals("Element")){
actionData.setElementData(resultName,responseBody);
} else {
actionData.setSessionData(resultName,responseBody);
}
actionData.setElementData("status","success");
} catch (Exception e) {
if(resultType.equals("Element")){
actionData.setElementData(resultName,e.toString());
} else {
actionData.setSessionData(resultName,e.toString());
}
actionData.setElementData("status","failure");
}
}
public String getUrl(String inputUrl)
{
String sRequestInput="{\"Test1\":\"Xyz\",\"Testing\": {\"Test1\":\"ABC\"}}";
Client c = Client.create();
WebResource webResource = c.resource(inputUrl);
ClientResponse response = webResource.type("application/json")
.post(ClientResponse.class, sRequestInput);
if (response.getStatus() != 200) {
throw new RuntimeException("Failed : HTTP error code : "+ response.getStatus());
}
String output=response.getEntity(String.class);
return "Response="+output;
}
}
Please suggest what I need to do.
Thanks
06-08-2018 11:19 AM
Depending on the type of error, there are two places to look:
global CVP error - C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.debug.runtime\AUDIUM_HOME\logs
application logs - C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.debug.runtime\AUDIUM_HOME\applications\[your application name]\logs
On a real CVP server the AUDIUM_HOME dir would instead be C:\Cisco\CVP\VXMLServer.
06-08-2018 12:19 PM
You can use System.out.println() in your custom java and it'll display
in the Debugger's Console window (bottom left) - doesn't display on vxml
server though.
06-12-2018 04:37 AM
I checked my logs in below directory and getting some error in log:
C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.debug.runtime\AUDIUM_HOME\logs
In the log the error is:
"SERVER ERROR: There was a problem loading classes from CVP_HOME\VXMLServer/common. The error was: There was a problem loading classes from CVP_HOME\VXMLServer/common. The root cause was: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonSerializableWithType"
Please let me know what I need to do.
Note:
I use System.out.println() in my custom java and it'll not display any logs in Debugger's Console window (bottom left)
Thanks
06-12-2018 05:38 AM
That's odd. Go to window /preferences /call studio /debug preferences... And select the checkboxes for display activity log and error log.
Sent from my Verizon 4G LTE smartphone
06-12-2018 05:39 AM
Put the jar files that are missing into debug.runtime/CatalinaHome/common/lib
Sent from my Verizon 4G LTE smartphone
06-12-2018 06:07 AM
Thanks for your help.
I have resolved the issue. Now it is working fine.
Now for custom element every time I am creating jar file of class and putting in the folder of debugger.
If want to put .class file in the call studio, so where I need to put the .class file in cisco call studio?
After putting the .class file where I Can see in Call studio GUI?
Thanks
06-12-2018 07:04 AM
Put the class file is in the studio app under appname /deploy /java/application /classes.
Then close the app and reopen it. Your element will display in the element pane, under Elements / Local Elements.
Sent from my Verizon 4G LTE smartphone
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide