forked from asterisk-java/asterisk-java
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:srt/asterisk-java
- Loading branch information
Showing
53 changed files
with
1,352 additions
and
131 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
*.ipr | ||
*.iws | ||
target | ||
.classpath | ||
.project | ||
.settings/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
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](http://asterisk.org). Asterisk-Java supports both interfaces that Asterisk provides for this scenario: The [FastAGI](https://wiki.asterisk.org/wiki/display/AST/Application_AGI) protocol and the [Manager API](https://wiki.asterisk.org/wiki/display/AST/The+Asterisk+Manager+TCP+IP+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. | ||
|
||
See docs/tutorial.html for examples. | ||
|
||
GETTING ASTERISK-JAVA | ||
--------------------- | ||
|
||
Asterisk-Java is available from http://asterisk-java.org | ||
|
||
INSTALLATION FROM SOURCE | ||
------------------------ | ||
|
||
git clone https://github.com/srt/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-mapping.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.asteriskjavafastagi.DefaultAgiServer | ||
|
||
SYSTEM REQUIREMENTS | ||
------------------- | ||
|
||
Asterisk-Java needs a Java Virtual Machine of at least version 1.6 ([Java SE 6.0](http://www.oracle.com/technetwork/java/javase/downloads/index.html)). If you want to build the jar from source, you will | ||
also need [Maven](http://maven.apache.org/). | ||
|
||
LEGAL | ||
----- | ||
|
||
Asterisk-Java is subject to the terms detailed in the license agreement accompanying it. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* Cloudvox - answer and control a phone call with Java | ||
Place and receive phone calls via open API: http://cloudvox.com/ | ||
Learn about call scripting, Asterisk/AGI, voice apps: http://help.cloudvox.com/ | ||
Added to the project and modified by Tropo: http://tropo.com */ | ||
|
||
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
callin.agi = ExampleCallIn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/main/java/org/asteriskjava/manager/action/ConfbridgeKickAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package org.asteriskjava.manager.action; | ||
|
||
/** | ||
* The ConfbridgeKickAction kicks a channel out of a conference. | ||
* | ||
* @author jmb | ||
* @version $Id$ | ||
*/ | ||
public class ConfbridgeKickAction extends AbstractManagerAction { | ||
|
||
/** | ||
* Serializable version identifier | ||
*/ | ||
private static final long serialVersionUID = 3827556611709875112L; | ||
|
||
private String conference; | ||
private String channel; | ||
|
||
/** | ||
* Creates a new empty ConfbridgeKickAction. | ||
*/ | ||
public ConfbridgeKickAction() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Creates a new ConfbridgeKickAction. | ||
* | ||
* @param conference the conference number. | ||
* @param channel number of the channel in the conference. | ||
*/ | ||
public ConfbridgeKickAction(String conference, String channel) { | ||
this.setConference(conference); | ||
this.setChannel(channel); | ||
} | ||
|
||
/** | ||
* Returns the name of this action, i.e. "ConfbridgeKick". | ||
*/ | ||
@Override | ||
public String getAction() { | ||
return "ConfbridgeKick"; | ||
} | ||
|
||
/** | ||
* Sets the id of the conference to kick a channel from. | ||
*/ | ||
public void setConference(String conference) { | ||
this.conference = conference; | ||
} | ||
|
||
/** | ||
* Returns the id of the conference to kick a channel from. | ||
*/ | ||
public String getConference() { | ||
return conference; | ||
} | ||
|
||
/** | ||
* Sets the number of the channel to kick. | ||
*/ | ||
public void setChannel(String channel) { | ||
this.channel = channel; | ||
} | ||
|
||
/** | ||
* Returns the number of the channel to kick. | ||
*/ | ||
public String getChannel() { | ||
return channel; | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/org/asteriskjava/manager/action/ConfbridgeListAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.asteriskjava.manager.action; | ||
|
||
public class ConfbridgeListAction extends AbstractManagerAction { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
private String conference; | ||
|
||
public ConfbridgeListAction() { | ||
} | ||
|
||
public ConfbridgeListAction(String conference) { | ||
this.conference = conference; | ||
} | ||
|
||
public void setConference(String conference) { | ||
this.conference = conference; | ||
} | ||
|
||
public String getConference() { | ||
return conference; | ||
} | ||
|
||
@Override | ||
public String getAction() { | ||
return "ConfbridgeList"; | ||
} | ||
|
||
} |
Oops, something went wrong.