<< Previous | Home

Asterisk-Java 1.0.0.M3 Released

Milestone 3 with support for OSGi and SLF4J

We have released milestone 3 of Asterisk-Java 1.0.0. Next to a few bug fixes this new milestone makes Asterisk-Java OSGi compliant, adds support for the modern SLF4J logging framework and makes debugging easier through built-in support for network tracing.

You can browse the full changelog to see which issues have been resolved.

The new release is available as a plain jar and a zip distribution at http://asterisk-java.org/download/1.0.0.M3. You can also browse the documentation and javadocs online.

The new milestone is also available through Maven:

<dependency>
  <groupId>org.asteriskjava</groupId>
  <artifactId>asterisk-java</artifactId>
  <version>1.0.0.M3</version>
</dependency>

Please report back any issues you encounter while using milestone 3 through our issue tracker. If you like to have a certain feature or bug fix included in the next version vote for it in Jira.

References

Built-in Support For Network Tracing

Using the org.asteriskjava.trace system property

Up to now the preferred way to obtain traces of the communication between Asterisk-Java and Asterisk was using tcpdump, wireshark or ngrep as described in Debugging Manager API. Having a full log of the direct network communication is often the only way to resolve issues related to problems in the Manager API or Fast AGI.

To make it easier for our users to obtain these traces we have now included a tracing feature directly into Asterisk-Java. You can enable it at runtime by setting the system property org.asteriskjava.trace to true. On the command line:

java -Dorg.asteriskjava.trace=true ...

Trace files are written to the temp dir by default ("java.io.temp"). You can specify an alternate location by using the org.asteriskjava.trace.directory system property:

java -Dorg.asteriskjava.trace=true \
     -Dorg.asteriskjava.trace.directory=/opt/traces ...

Log files contain a timestamp and the IP addresses and ports of the involved servers in their file name. A typical file looks like this:

2009-10-20T21:51:18.414CEST <<< Asterisk Call Manager/1.1
2009-10-20T21:51:18.536CEST >>> action: Challenge
                            >>> actionid: 888911819_0#
                            >>> authtype: MD5
                            >>>
2009-10-20T21:51:18.601CEST <<< Response: Success
2009-10-20T21:51:18.663CEST <<< ActionID: 888911819_0#
2009-10-20T21:51:18.664CEST <<< Challenge: 336054137
2009-10-20T21:51:18.665CEST <<<
2009-10-20T21:51:18.705CEST >>> action: Login
                            >>> actionid: 888911819_1#
                            >>> authtype: MD5
                            >>> username: manager
                            >>> key: ed0481d08ae7832fb
                            >>>
2009-10-20T21:51:18.768CEST <<< Response: Success
2009-10-20T21:51:18.831CEST <<< ActionID: 888911819_1#
2009-10-20T21:51:18.832CEST <<< Message: Authentication accepted
2009-10-20T21:51:18.833CEST <<<

This new feature is already part of the latest Asterisk-Java 1.0.0-CI-SNAPSHOT and will be shipped with milestone 3.

Please consider attaching a trace file to your bug reports in the future. It speeds up bug fixing considerably.

Asterisk-Java goes OSGi

Asterisk-Java now distributed with proper OSGi manifest headers

We are currently working on making Asterisk-Java OSGi compliant to make it easier for those users who want to use Asterisk-Java in an OSGi container like Equinox. This means Asterisk-Java will contain the proper bundle headers in its MANIFEST.MF and will follow the OSGi rules for version names. The new version names for Asterisk-Java are similar to those used by Spring Framework:

1.0.0.CI-SNAPSHOT
Continious integration snapshot releases
1.0.0.M3
Milestone releases
1.0.0.RC1
Release candidates
1.0.0.RELEASE
Final release
1.0.0.SR01
Service release with emergency bug fixes

The first OSGi compliant snapshots of Asterisk-Java are now available for download: Asterisk-Java 1.0.0.CI-SNAPSHOT. The old 1.0.0-SNAPSHOT releases will no longer be updated.
For those developers that are not interested in OSGi nothing will change. The OSGi manifest headers added to Asterisk-Java are simply ignored when run in a non-OSGi environment.

The new MANIFEST.MF looks like this:

Manifest-Version: 1.0
Bundle-Description: The free Java library for Asterisk PBX integration.
Bundle-DocURL: http://asterisk-java.org/
Bundle-ManifestVersion: 2
Bundle-Name: Asterisk-Java
Bundle-SymbolicName: org.asteriskjava
Bundle-Vendor: reucon
Bundle-Version: 1.0.0.CI-SNAPSHOT
Export-Package: org.asteriskjava;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.config;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.config.dialplan;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.fastagi;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.fastagi.command;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.fastagi.reply;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.manager;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.manager.action;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.manager.event;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.manager.response;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.manager.util;version="1.0.0.CI-SNAPSHOT",
 org.asteriskjava.live;version="1.0.0.CI-SNAPSHOT"

If you are looking for a ready to use OSGi based framework to develop AGI scripts for Asterisk on SpringSource dm Server you may also want to check ajdmserver.

Users: ADempiere Asterisk Integration

Calling Contacts from ADempire

ADempiere is a collection of Open Source ERP applications.

By leveraging Asterisk-Java the Asterisk integration for ADempiere provides support for calling contacts directly from within ADempiere.

Tags :

Asterisk-Java Sync to Maven Central Repo

Asterisk-Java now autmatically sync'ed to central

The released Asterisk-Java artifacts are now automatically published to Maven's central repository. This includes our milestone releases 1.0.0-m1 and 1.0.0-m2.

If you are already using Maven for development that means to you that you no longer have to download Asterisk-Java in order to use it. You can just declare a dependency and Maven automatically downloads it from central.

The Maven coordinates for Asterisk-Java are:

<dependency>
  <groupId>org.asteriskjava</groupId>
  <artifactId>asterisk-java</artifactId>
  <version>1.0.0-m2</version>
</dependency>

Asterisk-Java 1.0.0-m2 Released

On the way to the final 1.0.0 release

As most of the users already make use of many new features in 1.0.0-SNAPSHOT it is time to push the final release out of the door. As a first step I've released milestone 2 of 1.0.0 called 1.0.0-m2. Have a look at the changelog to see which bugs have been fixed and which new features are included.

Most notably milestone 2 includes support for the 1.6 series of Asterisk as well as support for using scripting languages with the FastAGI server.

The new release is available as a plain jar and a zip distribution at http://asterisk-java.org/download/1.0.0-m2. You can also browse the documentation and javadocs online.

Please report back any issues you encounter while using milestone 2 through our issue tracker. If you like to have a certain feature or bug fix included vote for it.

References

Scripting Support for FastAGI

Writing AGI scripts in Groovy, JavaScript, JRuby or PHP

Asterisk-Java 1.0.0 includes support for implementing AGI scripts in the scripting language of your choice. You still have the benefit of running on the JVM but for the implementation of your script you can now choose your favorite language.

I've prepared a small demo script that counts down from ten to zero. Then it plays a beep and waits for DTMF input to read the digit you've pressed back to you. You can exit by pressing star (*) or pound (#). To show you how this script looks like in the different languages it is implemented three times: In Groovy, JavaScript and PHP.

To get started just download the binary distribution of Asterisk-Java. Unpack it and run the asterisk-java.jar file from the unpacked directory.

$ cd asterisk-java-1.0.0-SNAPSHOT
$ java -jar asterisk-java.jar
May 13, 2009 1:26:16 AM org.asteriskjava.fastagi.DefaultAgiServer startup
INFO: Listening on *:4573.

The AGI scripts are put into the agi directory. There you'll also find the demo.groovy, demo.js and demo.php files. The lib directory contains additional libraries required to execute the scripts.

In addition to the functions provided by the scripting language Asterisk-Java adds two variables:

request
the request data including the dialed extension, the caller id, channel name, parameters and more
channel
for interacting with Asterisk, e.g. to stream files, receive DTMF digits or execute dialplan applications

Modify your dialplan and add extensions for the demo scripts:

exten => 2000,1,Agi(agi://localhost/demo.groovy)
exten => 2001,1,Agi(agi://localhost/demo.js)
exten => 2002,1,Agi(agi://localhost/demo.php)

If you are not running Asterisk-Java on the same server as Asterisk replace localhost by the hostname of the machine running Asterisk-Java.

Note that you will need at least Java 6 to make use of the new scripting support.

Asterisk-Java Lightning Talk @ JUGC

May, 29th 2009

I will give a short presentation of Asterisk-Java (in German) at the Java User Group Cologne (JUGC) on May 29th.

It will be a short overview of what Asterisk-Java can do and how it can be used to add phone support to Java applications. The presentation will have a duration of 5 to 10 minutes and include a small interactive demo that serves as a show case.

The main talk will be about JSF 2.0 vs Struts 2.1. I would be happy to meet a few Asterisk-Java developers over there.

The slides are available (in German) at slideshare.

Users: Asterisk and CTI, what’s that all about?

Some inspriation for playing with the Asterisk APIs

Sameh Shaker has posted some examples of what you can do with Asterisk using the Manager API and Fast AGI. I think it's a good starting point for new users of Asterisk-Java to get some inspiration for their own applications.

References

Tags :

Speech Recognition with Asterisk-Java

Using the Lumenvox engine with Java

The latest snapshot of Asterisk-Java contains support for the Asterisk Speech API. This makes writing AGI script that recognize speech as easy as writing AGI scripts for DTMF input.

All you need to get started is a recent version of Asterisk 1.6 and the Lumenvox Speech Engine. For development you can buy a starter kit from Digium for 50 USD.

In your AGI script you initialize the speech engine, load and activate a grammer and are ready to recognize speech. The speechRecognize() method takes a voice prompt as its first parameter. The prompt is played to the user and the users response is recognized. The user doesn't have to wait for the prompt to finish, he can start talking right away ("barge in"). The corresponding Java code looks like this:

speechCreate();
speechLoadGrammar("digits", grammarPath);
speechActivateGrammar("digits");
SpeechRecognitionResult result = 
  speechRecognize("speech-demo/prompt", 10);
speechDeactivateGrammar("digits");

The SpeechRecognitionResult provided by Asterisk-Java contains the result and the confidence score – a value between 0 and 1000 that indicates how sure the speech engine is that the result is correct. The Java code to evaluate the result looks like this:

if (result.isSpeech())
{
    if (result.getScore() > 990)
    {
        streamFile("speech-demo/absolutely-sure");
    }
    else if (result.getScore() > 800)
    {
        streamFile("speech-demo/pretty-sure");
    }
    else
    {
        streamFile("speech-demo/not-sure");
    }

    // say what we have recognized
    sayDigits(result.getText());
}       

Finally call speechDestory to end the speech recognition session (for a real application you probably want to do this in a finally block):

speechDestroy();

Pretty easy, isn't it?

You can have a look at the SpeechDemo AGI script or download the full demo that includes the latest snapshot of Asterisk-Java, the voice prompts and the AGI script.