cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2805
Views
5
Helpful
7
Replies

Call Studio new JAVA Project and AUDIUM_HOME

Slavik Bialik
Level 7
Level 7

Hi,

I'm a little bit new to Call Studio and Java projects. It is the first time I am trying to program my own Voice Element to be used in the CVP call flow. I created a simple JAVA code and created a new class for my element, I don't think that I'm having an issue with the code itself... (also I loaded the framework.jar and some others)

 

But when I'm trying to run the code I'm getting always:

*** ERROR: An error occurred during initialization of the settings: AUDIUM_HOME must be defined in order for Cisco Unified CVP VXML Server to function. This is typically done by creating an environment variable whose value points to the installation directory. This directory can also be defined by specifying a Java system property named "Audium.Home" or creating an initial parameter named "AUDIUM_HOME" within the web.xml file of the CVP.war file. ***

 

I don't really know if I need to run the code in the Call Studio in order to test it, again, it is my first time... can anyone elaborate if the above is an issue or not? 

Besides the above error, I'm not having any errors in the code itself.

 

Plus, how do I make the new Voice Element to appear in my Call Studio Project on the call flow designer in the elements navigation browser? 

 

Thank you!

Best regards,

  Slavik Bialik.

1 Accepted Solution

Accepted Solutions

I can't tell what you've done wrong but when I compile your code and
1.copy the full package into my Studio app named MyApp1/deploy/java/application/classes/company/HttpRequest.class
2.close the MyApp1 project out of Studio
3.open MyApp1 project in Studio
4. Look under Elements/LocalElements
then I see the Test/HttpRequest element (see screenshot).

View solution in original post

7 Replies 7

Slavik Bialik
Level 7
Level 7
OK, regarding the above error I think I found the right place to configure the AUDIUM_HOME base path. Under the Run Configurations, in the Environment tab I created an environment variable called AUDIUM_HOME and I pointed it to:
C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.debug.runtime\AUDIUM_HOME
Please correct me if I need to point somewhere else.

But regarding my second question, I am still not able to see my "programmed" element object in the elements navigation explorer in my call flow project.

For now, copy the compiled java class (including its package directory structute) into the studio application's subfolder named appname/deploy/java/application/classes

Then close the call studio app (right-click > close project) and then re-open the project (right-click > open project).

The new element should display under Elements/LocalElements.

If it doesn't then there's an Error Log that should tell you why it doesn't display. You can open this log by clicking the Window button at the top of call studio: Window > Show View > Call STudio Error Log.

When the log displays (bottom of Call Studio screen), you'll need to right-click in that pane and select Open Log. Then the most recent error message is at the bottom of the log.

Wow, thank you very much for the detailed answer! I'll try it tomorrow and let you know.

Hi,

I'm not able to do that. :(

 

After compiled it, I took the HttpRequest.class file and copied it to the folder project: HttpRequest/deploy/java/application/classes. Closed the project and re-opened it. And I still cannot see the object anywhere.

 

Also tried to open the error logs of the CVP Call Studio and I couldn't see anything there.

 

Here's the sample Java code:

package company;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.HashMap;
import java.util.Hashtable;


import com.audium.core.vfc.VException;
import com.audium.core.vfc.util.VMain;
import com.audium.server.AudiumException;
import com.audium.server.global.ApplicationAPI;
import com.audium.server.session.VoiceElementData;
import com.audium.server.voiceElement.ElementData;
import com.audium.server.voiceElement.ElementException;
import com.audium.server.voiceElement.ElementInterface;
import com.audium.server.voiceElement.ExitState;
import com.audium.server.voiceElement.Setting;
import com.audium.server.voiceElement.VoiceElementBase;
import com.audium.server.xml.VoiceElementConfig;
import org.json.*;


public class HttpRequest extends VoiceElementBase implements ElementInterface {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
	}

	public String getElementName() {
		return "HttpRequest";
	}
	
	public String getDescription() {
		return "Make HTTP Request";
	}
	
	public String getDisplayFolderName() {
		return "Test";
	}
	
	public Setting[] getSettings() throws ElementException
	{
	  Setting[] cfg_settings = {  };
	  return cfg_settings;
	}
	
	public ExitState[] getExitStates() throws ElementException
	{
	  ExitState done = new ExitState("done", "done", "Get success");
	  ExitState error = new ExitState("error", "error", "Get error");

	  ExitState[] exitStateArray = { done, error };
	  return exitStateArray;
	}

	public ElementData[] getElementData() throws ElementException
	{
	  return null;
	}

	protected String addXmlBody(VMain arg0, Hashtable arg1,
		VoiceElementData arg2) throws VException, ElementException {

		try {
	        URL url = new URL("some url");
	        System.out.println("[HttpRequest] url: " + url);
	        HttpURLConnection con = (HttpURLConnection) url.openConnection();
	        con.setRequestMethod("GET");
	        con.setRequestProperty("Accept", "application/json");
	        System.out.println("[HttpRequest] Response code: " + con.getResponseCode());
	        BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"));
	        StringBuilder response = new StringBuilder();
	        String responseLine = null;

	        while ((responseLine = br.readLine()) != null) {
	            response.append(responseLine.trim());
	        }
	        System.out.println(response.toString());

	        con.disconnect();
			
		} catch (JSONException ex) {
			return null;
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ProtocolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	

	public String[] getAudioGroupDisplayOrder() {
		// TODO Auto-generated method stub
		return null;
	}

	public HashMap getAudioGroups() throws ElementException {
		// TODO Auto-generated method stub
		return null;
	}
}

I can't tell what you've done wrong but when I compile your code and
1.copy the full package into my Studio app named MyApp1/deploy/java/application/classes/company/HttpRequest.class
2.close the MyApp1 project out of Studio
3.open MyApp1 project in Studio
4. Look under Elements/LocalElements
then I see the Test/HttpRequest element (see screenshot).

By the way, is there a reason to create this element as a Voice element - they're usually only created if you need to interact directly with the caller on the voice browser. They're much more complex to create and get working than creating other elements.

 

If you're just trying to make an HttpRequest, I'd recommend creating a Decision Element with multiple exit states. Then you need not worry about sending something to the voice browser. Just save the info into Element or Session Data and use one of the Studio voice elements (like Audio) to play the info to the caller.

 

I'll attach a sample Decision Element that Paul Tindall of Cisco made available years back as an example.

 

 

 

 

 

 

Thank you very much! I was finally able to make the element appear and use it on my application and it works great.

I'll investigate what you suggested regarding the decision element, as it makes more sense not to use the voice browser for those kind of actions.