login | register
Fri 09 of May, 2008 [16:57 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Nick Barnes, Fri 09 of May, 2008 [11:36 UTC]: Christopher - yesterday I tried an Asterisk install on a CentOS 5.1 box with stock GUI and it all worked fine. Sorry I can't help.
  • aero, Fri 09 of May, 2008 [08:20 UTC]: can someone help me out on this, i tried to play some sound files on my asterisk box and this is the error message i got. WARNING[4429]: format_wav.c:169 check_header: Unexpected freqency 22050 May 8 11:17:39 WARNING[4433]: codec_gsm.c:194 gsmtolin_fra
  • Christopher Faust, Thu 08 of May, 2008 [14:15 UTC]: I beleive that I may have to change something in the xserver configuration. Please advise
  • Christopher Faust, Thu 08 of May, 2008 [14:14 UTC]: Everything was perfect. In the bios I have increased the memory allocated Still receive input not supported on my display.
  • Christopher Faust, Thu 08 of May, 2008 [14:13 UTC]: This would not be my main box. I am doing some testing to see if I can install zaptel and asterisk 1.4 on a full centos 5.1 box with development software Its bizzare, because before I went through the asterisk and zaptel installation everything was perfe
  • Nick Barnes, Thu 08 of May, 2008 [13:44 UTC]: Christopher - I can't see any way in which an Asterisk installation would muck your GUI, but remember that it is advised not to use a GUI on an Asterisk box anyway.
  • Christopher Faust, Wed 07 of May, 2008 [15:28 UTC]: When I try to startx I ge input not supported. Though before installing asterisk I had no video issue to start the GUI
  • Christopher Faust, Wed 07 of May, 2008 [15:26 UTC]: Hi Nick, I got centos 5.1 and asterisk up But now I cannot start startx I have set the depth from 24 to 16 for the video i810 driver for the i845 on my netvista machine but I cannot start GNOME. Please advise
  • Nick Barnes, Wed 07 of May, 2008 [10:01 UTC]: Howard - You'll need to provide a lot more information if you really want help.
  • Nick Barnes, Wed 07 of May, 2008 [10:00 UTC]: Christopher - Search the Wiki and you'll find a page I wrote detailing exactly what you have to do for Asterisk 1.4 + CentOS 5.1.
Server Stats
  • Execution time: 0.57s
  • Memory usage: 2.21MB
  • Database queries: 33
  • GZIP: Disabled
  • Server load: 1.39

Asterisk-java

Asterisk-Java

The Asterisk-Java package consists of a set of Java classes that allow you to easily build Java applications that interact with an Asterisk PBX Server. Asterisk-Java supports both interfaces that Asterisk provides for this scenario: The FastAGI protocol and the Manager API.

The FastAGI implementation supports all commands currently available from Asterisk.

The Manager API implementation supports receiving events from the Asterisk server (e.g. call progess, registered peers, channel state) and sending actions to Asterisk (e.g. originate call, agent login/logoff, start/stop voice recording).

A complete list of the available events and actions is available in the javadocs.

Asterisk-Java is available under Apache license from http://asterisk-java.org/.

News

09/05/2007:
Asterisk-Java 0.3.1 has been released.

07/01/2007:
Asterisk-Java 0.3 has been released.

02/12/2006:
Asterisk-Java 0.3-m2 has been released.

08/26/2006:
Asterisk-Java 0.3-m1 has been released.
The 0.3-m1 milestone release focuses on ease of use and provides the new org.asteriskjava.live package that takes care of the lowlevel action and event handling of the Manager API and offers an intuitive API for Java developers. Asterisk-Java has been updated to take advantage of the new features of Java 5.0 and therfore requires a Java Virtual Machine of at least version 1.5.0. The package name has been changed from net.sf.asterisk to org.asteriskjava.

11/27/2005:
Asterisk-Java 0.2 has been released.
Since 0.2-rc2 some minor bugs have been fixed and support for several last minute additions to Asterisk 1.2 has been added.

10/29/2005:
The 0.2-rc2 release candidate focuses on the new features of the Asterisk 1.2 series though it still supports Asterisk 1.0.x.
The changes include
  • Bug fix for variables in OriginateAction (AJ-15)
  • Support for FaxReceived event from spandsp (AJ-20)
  • Better integration with Spring Framework via SimpleMappingStrategy and AGIServerThread

08/31/2005:
The 0.2-rc1 release candidate focuses on the new features of Asterisk 1.2-beta1 though it still supports Asterisk 1.0.x.
The changes include
  • Support for the new Actions, Events and Commands of Asterisk 1.2
  • New support for event generating Actions, i.e. Actions that send their result as a series of Event rather than the usual ManagerResults. See the sendEventGeneratingAction() methods in ManagerConnection for more information.
  • New base class for AGI scripts that allows you write cleaner AGI scripts as you don't have to pass the channel variable to all methods.
  • New convenience constructors for manager actions
  • Some minor bug fixes

References

Asterisk-Java is used in several commercial environments and by the following Open Source projects:
  • Asterisk-IM: A plugin for the Jive Messenger XMPP (jabber) server. It provides integrated presence between your IM client and phone, notification of incoming calls by IM and originate calls from supported IM clients.
  • Asterisk Desktop Manager (ADM): A desktop application that will allow for automatic on-call volume reduction, one click dial from clipboard, integrated phonebook and more.

Examples

The following HelloAGIScript shows how a simple AGI script implemented using Asterisk-java might look like:

import net.sf.asterisk.fastagi.AGIChannel;
import net.sf.asterisk.fastagi.AGIException;
import net.sf.asterisk.fastagi.AGIRequest;
import net.sf.asterisk.fastagi.BaseAGIScript;

public class HelloAGIScript extends BaseAGIScript
{
    public void service(AGIRequest request, AGIChannel channel)
            throws AGIException
    {
        // Answer the channel...
        answer();
		
        // ...say hello...
        streamFile("welcome");
		
        // ...and hangup.
        hangup();
    }
}


Sending an action via the Manager API is also quite easy:
import java.io.IOException;

import net.sf.asterisk.manager.AuthenticationFailedException;
import net.sf.asterisk.manager.ManagerConnection;
import net.sf.asterisk.manager.ManagerConnectionFactory;
import net.sf.asterisk.manager.TimeoutException;
import net.sf.asterisk.manager.action.OriginateAction;
import net.sf.asterisk.manager.response.ManagerResponse;

public class HelloManager
{
    private ManagerConnection managerConnection;

    public HelloManager() throws IOException
    {
        ManagerConnectionFactory factory = new ManagerConnectionFactory();

        this.managerConnection = factory.getManagerConnection("localhost",
                "manager", "pa55w0rd");
    }

    public void run() throws IOException, AuthenticationFailedException,
            TimeoutException
    {
        OriginateAction originateAction;
        ManagerResponse originateResponse;

        originateAction = new OriginateAction();
        originateAction.setChannel("SIP/John");
        originateAction.setContext("default");
        originateAction.setExten("1300");
        originateAction.setPriority(new Integer(1));
        originateAction.setTimeout(new Integer(30000));

        // connect to Asterisk and log in
        managerConnection.login();

        // send the originate action and wait for a maximum of 30 seconds for Asterisk
        // to send a reply
        originateResponse = managerConnection.sendAction(originateAction, 30000);

        // print out whether the originate succeeded or not
        System.out.println(originateResponse.getResponse());

        // and finally log off and disconnect
        managerConnection.logoff();
    }

    public static void main(String[] args) throws Exception
    {
        HelloManager helloManager;

        helloManager = new HelloManager();
        helloManager.run();
    }
}


For a discussion of these examples see the Tutorial.

See also


Go back to Asterisk
Created by srt, Last modification by srt on Thu 06 of Sep, 2007 [01:21 UTC]

Comments Filter

by Xavier Kennan on Sunday 02 of April, 2006 [04:37:45 UTC]

by Xavier Kennan on Sunday 02 of April, 2006 [04:37:33 UTC]

Getting Extension State

by Xavier Kennan on Sunday 02 of April, 2006 [04:36:33 UTC]
How do I get extension state using the Asterisk-Java API? The application I am working on requires that it be notofied when phones go off-hook. It has to know the state of the extensions. I know it's possible because FOP apparently displays it. Anyone have a snippet of code? Apologies for the newbee question.

Please update this page with new information, just login and click on the "Edit" or "Add Comment" button above. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2008 VOIP-Info.org LLC

Powered by bitweaver