Skip to end of metadata
Go to start of metadata

Components that interact with Asterisk SCF may be written in Java. They can do this by using the Java bindings for the Asterisk SCF interfaces.

Asterisk SCF provides an Ant build.xml file for building the Java bindings, and installing them into the local Maven repository.

1. Build instructions

Before your begin, you must build Asterisk SCF itself. See the appropriate install page for details.

If you've built Asterisk SCF from a clone of gitall, then you can cd into the slice directory. Otherwise, you can obtain the latest Slice definitions by cloning git://git.asterisk.org/asterisk-scf/integration/slice.

Icon

Be sure that the Slice definitions you are using are consistent with those you used to compile Asterisk SCF. The safest thing to do is to just build the Java bindings from the same sources you used to build Asterisk SCF.

1.1. Using Maven

If you wish to use Maven to build your Java based Asterisk SCF components, you must either deploy the Ice and Asterisk SCF .jar's to your own artifact repository, or install them into your local Maven repository. If you wish to use Maven, it's assumed that you already know a bit about it. If you have a team of developers, and want to share artifacts using a central Maven repository, such as Artifactory or Nexus, it's assumed that you already know all about that, too.

1.1.1. (Option 1) Deploying Ice to a remote repository

If you're using a remote Maven repository, you must deploy the Ice.jar file to it. Our build.xml file provides a deploy-ice target to help you out. You only need to do this once, or whenever you re-compile Ice.

  1. Create the file ~/.ant/repositories.properties, with the URL's for your repository manager
  2. Add the following section to your ~/.m2/settings.xml file.
    Icon

    Unfortunately, the Maven Ant Tasks do not support password encryption, so the password must be in plaintext.

  3. Set the environment variable ICE_HOME to your Ice installation prefix.
  4. Change to the slice directory, and run ant ice.deploy-ice

1.1.2. (Option 2) Installing Ice to the local repository

If you're not using a remote repository, you may instead just deploy it to your local repository. Once again, out build.xml helps you out with a install-ice target. Similarly, You only need to do this once, or whenever you re-compile Ice.

  1. Set the environment variable ICE_HOME to your Ice installation prefix.
  2. Change to the slice directory, and run ant ice.install-ice

1.1.3. Usage with Maven

For your component, add the following dependency to its pom.xml file:

1.2. Not using Maven

If you're not using Maven for your dependency management, you can simply build that Asterisk SCF API .jar file and use it directly.

  1. Set the environment variable ICE_HOME to your Ice installation prefix.
  2. Change to the slice directory, and run ant package

The build generates the following files:

  • ./java/asterisk-scf-api.jar
  • ./java/asterisk-scf-api-javadoc.jar
  • ./java/asterisk-scf-api-sources.jar

Copy ./java/asterisk-scf-api.jar to wherever you like to keep Java libraries, and add it to your classpath. Also add $ICE_HOME/lib/Ice.jar to your classpath, where $ICE_HOME is the installation prefix for your Ice install.

If you use an IDE, I also recommend attaching the sources and javadoc to the library. This makes navigating the API much easier.

  • No labels

1 Comment

  1. Before your begin, you much build Asterisk SCF itself.
    should be
    Before you begin, you must build Asterisk SCF itself.

    from the same sources as you built Asterisk SCF.
    should be
    from the same sources you used to build Asterisk SCF.