Overview  

  CSTA-SDK Overview  

 

  Previous Section    Next Section

FRAMES     NO FRAMES    


 

Contents

 

Developing CSTA applications with the CSTA SDK

Installing the development environment

Java SDK (JDK)

Eclipse IDE for Java Developers

Additional libraries

Adding the CSTA SDK Documentation to the Project

Tracing and Logging

Creating a project that uses the CSTA SDK

 

 

 

Developing CSTA applications with the CSTA SDK

This document explains how to develop a CSTA application using the OpenScape Voice CSTA SDK.

This document has four sections:

·         Installing the development environment

·         Creating a project that uses the CSTA SDK (set up libraries, etc.)

·         Developing a CSTA application to monitor a device

·         Developing a CSTA application to deflect incoming calls

Installing the development environment

The CSTA SDK is a Java application. It can be used with any IDE that supports Java development. In this document we use the eclipse IDE.

The development environment has three pieces:

·         The Java SDK: this piece comes from Oracle/Sun. It has the Java compiler and libraries.

·         The eclipse IDE: this piece comes from the eclipse Foundation. It has the front-end IDE and invokes the compiler from the Java SDK to build the applications.

·         Additional libraries: the CSTA SDK uses log4j for logging and the Simple XML library for XML parsing and building.

Java SDK (JDK)

·         Download the latest Java SDK from http://java.sun.com/javase/downloads/index.jsp

o       Make sure you are downloading the development kit (JDK), not the runtime environment JRE

o       Pick the simplest SDK, usually called "Java Platform" or "Java SE" (for Standard Edition)

o       Follow the prompts to install it

 

 

NOTE: The CSTA SDK was tested with Java 1.6 (a.k.a. Java 6). This is the only version guaranteed to work correctly. Java normally does its best to ensure backward compatibility, but there is no guarantee the CSTA SDK will work correctly until it is tested.

 

Eclipse IDE for Java Developers

The CSTA-SDK was developed using the Eclipse IDE and the code examples are based on the same platform, but nothing prevents that the delivered library be used with any other JAVA IDE, or standalone JAVA development tool. Below, we have the basic instruction to use Eclipse.

 

·         Download it from http://www.eclipse.org/downloads/

o       There are several packages for Eclipse

o       The minimum we need is the "Eclipse IDE for Java Developers" one

·         There is no installation for Eclipse

·         Unzip to a folder and create a shortcut to eclipse.exe

Additional libraries

The CSTA-SDK makes use of 2 Open Source libraries. Both libraries are Licensed under the Apache License, Version 2.0:

 

·         Apache Log4J: Apache log4j is a Java-based logging utility. You can download log4j from http://logging.apache.org/log4j/1.2/download.html

·         Simple XML: Simple is a high performance XML serialization and configuration framework for Java. You can download simple-xml from http://simple.sourceforge.net/download.php

 

NOTE: The CSTA SDK was tested with log4j 1.2.16 and simple-xml 2.3.3. These are the only version guaranteed to work correctly. Normally these libraries will ensure backward compatibility, but there is no guarantee the CSTA SDK will work correctly until it is tested with any other version of these libraries.

 

 

 

Adding the CSTA SDK Documentation to the Project

 

Eclipse allows that the documentation of the CSTA SDK API be integrated with the Eclipse environment. If you add the CSTA SDK documentation to you application project, Eclipse will provide the information how to use the CSTA SDK.

To have the CSTA SDK documentation integrated to your project, follow the following steps:

·         Add the CSTA SDK jar file into the Project build path ( Project à Properties à Java Build Path.

·         Save the \doc folder provided with the  CSTA-SDK zip file to the local disk.

·         Right click openscape-csta-sdk-1.0.0.jar, select Properties

 

 

·         Select JavaDoc location à Javadoc in archive,

·         Select Archive path to be the location where the \doc folder was uncompressed

·         Click Validate button, to get a successful message box, and click apply.

 

 

 

 

Tracing and Logging

 

The CSTA-SDK uses the Apache Log4J as base for all logging. There are two ways to configure log4j. One is with a properties file and the other is with an XML file. The CSTA-SDK uses the XML file.

The configuration file provided with the CSTA-SDK is shown below. This file can be modified to fit the application requirements but is strongly recommended that the Log format do not be modified, to allow an easy analysis of eventual problems.

For more information about the use of Log4j and its configuration, please see Log4J Manual.

 

 

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

 

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

 

  <!-- Log output to Console -->

  <appender name="console" class="org.apache.log4j.ConsoleAppender">

    <param name="Target" value="System.out"/>

    <layout class="org.apache.log4j.PatternLayout">

      <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n"/>

    </layout>

  </appender>

 

  <!-- Log output to the file. Auto backup the file when it reaches size of 1M and up to 128 backup files -->

  <appender name="rolling" class="org.apache.log4j.RollingFileAppender">

    <param name="file" value="CSTA-SDK.log"/>

    <param name="MaxFileSize" value="1000KB"/>

    <param name="MaxBackupIndex" value="128"/>

    <param name="append" value="true" />

    <param name="encoding" value="UTF-8" /> 

    <layout class="org.apache.log4j.PatternLayout">

      <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n"/>

    </layout>

  </appender>

 

  <!-- Log to both Console and File -->

  <root>

    <priority value ="debug" />

    <appender-ref ref="console" />

    <appender-ref ref="rolling" />

  </root>

 

The basic output of the CSTA-SDK log is shown below:

 

                           
2010-08-24 08:29:39,730 [Thread-1] DEBUG com.sen.openscape.csta.transport.tcp.CstaTcpLink - MessageLength=4
2010-08-24 08:29:39,730 [Thread-1] INFO  com.sen.openscape.csta.transport.tcp.CstaTcpLink - Received CSTA Message: 9999<?xml version="1.0" encoding="UTF8"?><ConnectionClearedEvent . . .
2010-08-24 08:29:39,746 [Thread-1] DEBUG com.sen.openscape.csta.callcontrol.CstaMonitor - Connection is valid.
2010-08-24 08:29:39,746 [Thread-1] DEBUG com.sen.openscape.csta.callcontrol.CstaMonitor - Connection callID=FF000100000000002EBB734C18000000;deviceID=+15619231972 is removed from the list
                 

                 

 

 

Creating a project that uses the CSTA SDK

Every CSTA SDK project needs the steps below to ensure that the libraries the project needs can be found as the code is written and built.

·         Open eclipse

o       Create a new project

o       File à New à Java Project

o       Enter a name

o       Click on Finish - we will use all the default options in our examples

·         Add the OpenScape CSTA SDK, log4j and simple-xml to the project

o       Right click project name in Package Explorer

o       Choose New à Folder

o       Enter lib as a name

o       Drag the jar files into that folder

·         Add the JARs to the build path

o       Right click the project Name in Package Explorer

o       Choose Properties

o       Go to Java Build Path

o       Select the Libraries path

o       Click on Add JARs

o       Navigate to the lib folder created above

o       Highlight all JARs

o       Click OK to Add the JARs

o       Click OK on the Properties window to close it

This is how the project looks like after those steps: