• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

asterisk-java/asterisk-java: The free Java library for Asterisk PBX integration.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

asterisk-java/asterisk-java

开源软件地址:

https://github.com/asterisk-java/asterisk-java

开源编程语言:

Java 99.5%

开源软件介绍:

README for Asterisk-Java

INTRODUCTION

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.

You can find the Java docs for the lastest version here: JavaDoc

FastAGI

FastAGI lets you create a service that manages a call in a similar way to what a webserver handles a http request. FastAGI can be (and should be) used to replace dialplan. FastAGI is thousands of times faster than dialplan, easier to debug and lets you do call control in a language that you are familiar with.

The FastAGI implementation supports all commands currently available from Asterisk.

Manager API

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). If you like, the Manager API allows you start and manipulate calls. A complete list of the available events and actions is available in the javadocs.

Activities

Activities are new to asterisk-java 2.0. The aim of Activities is to provide a high level interface to interactions with Asterisk. Whist Activities use both FastAGI and the Manager API you would normally consider Activities as a replacement for the Manager API.

Activities provide a simple and consistent method of interaction with Asterisk without having to worry about issues such as connection management and without having to understand the intricacies of Asterisk Manager Actions and Events.

Getting Started

Tutorial

Activities

Examples

GETTING ASTERISK-JAVA

Asterisk-Java is available from here

Maven Dependency

Asterisk-Java 3.x (Java 1.8 and Asterisk Version 10 thru 18) (master)

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

INSTALLATION FROM SOURCE

git clone https://github.com/asterisk-java/asterisk-java.git
cd asterisk-java
mvn install

After the build is complete, the jar will then be built as target/asterisk-java.jar in the asterisk-java directory.

EXAMPLE

The file 'examples/ExampleCallIn.java' will answer the call and playback the audio file 'tt-monkeys'.

import org.asteriskjava.fastagi.AgiChannel;
import org.asteriskjava.fastagi.AgiException;
import org.asteriskjava.fastagi.AgiRequest;
import org.asteriskjava.fastagi.BaseAgiScript;
/* Example incoming call handler
Answer call, speak message */
public class ExampleCallIn extends BaseAgiScript {
  public void service(AgiRequest request, AgiChannel channel) throws AgiException {
    answer();
    exec("Playback", "tt-monkeys"); 
    hangup();
  }
}

The file 'examples/fastagi.properties' maps your Asterisk diaplan context to the class you would like to invoke above.

callin.agi = ExampleCallIn

To compile and run do:

javac -cp asterisk-java.jar ExampleCallIn.java
java -cp asterisk-java.jar org.asteriskjava.fastagi.DefaultAgiServer

SYSTEM REQUIREMENTS

Asterisk-Java needs a Java Virtual Machine of at least version 1.8 (Java SE 8.0). If you want to build the jar from source, you will also need Maven.

LEGAL

Asterisk-Java is subject to the terms detailed in the license agreement accompanying it.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
javastacks/javastack: Java技术栈,分享最主流的 Java 技术。发布时间:2022-06-24
下一篇:
MithunTechnologiesDevOps/java-web-app-docker发布时间:2022-06-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap