|
Asterisk-Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AsteriskServer
The AsteriskServer is built on top of the
ManagerConnection
and is an attempt to
simplify interaction with Asterisk by abstracting the interface.
Method Summary | |
---|---|
void |
addAsteriskServerListener(AsteriskServerListener listener)
Adds a listener to this AsteriskServer. If this server is not yet connected it will be implicitly connected. |
java.util.List<java.lang.String> |
executeCliCommand(java.lang.String command)
Executes a command line interface (CLI) command. |
java.util.Collection<AsteriskAgent> |
getAgents()
Return the agents, registered at Asterisk server. |
AsteriskChannel |
getChannelById(java.lang.String id)
Returns a channel by its unique id. |
AsteriskChannel |
getChannelByName(java.lang.String name)
Returns a channel by its name. |
java.util.Collection<AsteriskChannel> |
getChannels()
Returns the active channels of the Asterisk server. |
ConfigFile |
getConfig(java.lang.String filename)
Reads the given Asterisk configuration file. |
java.lang.String |
getGlobalVariable(java.lang.String variable)
Returns the value of the given global variable. |
ManagerConnection |
getManagerConnection()
Returns the underlying ManagerConnection. |
MeetMeRoom |
getMeetMeRoom(java.lang.String roomNumber)
Returns the MeetMe room with the given number, if the room does not yet exist a new MeetMeRoom object is created. |
java.util.Collection<MeetMeRoom> |
getMeetMeRooms()
Returns the acitve MeetMe rooms on the Asterisk server. |
java.util.Collection<AsteriskQueue> |
getQueues()
Returns the queues served by the Asterisk server. |
java.lang.String |
getVersion()
Returns the exact version string of this Asterisk server. |
int[] |
getVersion(java.lang.String file)
Returns the CVS revision of a given source file of this Asterisk server. |
java.util.Collection<Voicemailbox> |
getVoicemailboxes()
Returns a collection of all voicemailboxes configured for this Asterisk server with the number of new and old messages they contain. |
void |
initialize()
Opens the connection to this server. |
boolean |
isModuleLoaded(java.lang.String module)
Checks whether a module is currently loaded. |
void |
loadModule(java.lang.String module)
Loads a module or subsystem |
AsteriskChannel |
originate(OriginateAction originateAction)
Generates an outgoing channel. |
void |
originateAsync(OriginateAction originateAction,
OriginateCallback cb)
Asynchronously generates an outgoing channel. |
AsteriskChannel |
originateToApplication(java.lang.String channel,
java.lang.String application,
java.lang.String data,
long timeout)
Generates an outgoing channel to an application. |
AsteriskChannel |
originateToApplication(java.lang.String channel,
java.lang.String application,
java.lang.String data,
long timeout,
CallerId callerId,
java.util.Map<java.lang.String,java.lang.String> variables)
Generates an outgoing channel to an application and sets an optional map of channel variables. |
void |
originateToApplicationAsync(java.lang.String channel,
java.lang.String application,
java.lang.String data,
long timeout,
CallerId callerId,
java.util.Map<java.lang.String,java.lang.String> variables,
OriginateCallback callback)
Asynchronously generates an outgoing channel to an application and sets an optional map of channel variables. |
void |
originateToApplicationAsync(java.lang.String channel,
java.lang.String application,
java.lang.String data,
long timeout,
OriginateCallback callback)
Asynchronously generates an outgoing channel to an application. |
AsteriskChannel |
originateToExtension(java.lang.String channel,
java.lang.String context,
java.lang.String exten,
int priority,
long timeout)
Generates an outgoing channel to a dialplan entry (extension, context, priority). |
AsteriskChannel |
originateToExtension(java.lang.String channel,
java.lang.String context,
java.lang.String exten,
int priority,
long timeout,
CallerId callerId,
java.util.Map<java.lang.String,java.lang.String> variables)
Generates an outgoing channel to a dialplan entry (extension, context, priority) and sets an optional map of channel variables. |
void |
originateToExtensionAsync(java.lang.String channel,
java.lang.String context,
java.lang.String exten,
int priority,
long timeout,
CallerId callerId,
java.util.Map<java.lang.String,java.lang.String> variables,
OriginateCallback callback)
Asynchronously generates an outgoing channel to a dialplan entry (extension, context, priority) and sets an optional map of channel variables. |
void |
originateToExtensionAsync(java.lang.String channel,
java.lang.String context,
java.lang.String exten,
int priority,
long timeout,
OriginateCallback callback)
Asynchronously generates an outgoing channel to a dialplan entry (extension, context, priority). |
void |
reloadAllModules()
Reloads all currently loaded modules. |
void |
reloadModule(java.lang.String module)
Reloads a module or subsystem. |
void |
removeAsteriskServerListener(AsteriskServerListener listener)
Removes a listener from this Asterisk server. |
void |
setGlobalVariable(java.lang.String variable,
java.lang.String value)
Sets the value of the given global variable. |
void |
shutdown()
Closes the connection to this server. |
void |
unloadModule(java.lang.String module)
Unloads a module or subsystem. |
Method Detail |
---|
ManagerConnection getManagerConnection()
AsteriskChannel originate(OriginateAction originateAction) throws ManagerCommunicationException, NoSuchChannelException
originateAction
- the action that contains parameters for the originate
NoSuchChannelException
- if the channel is not available on the
Asterisk server, for example because you used "SIP/1310" and 1310
is not a valid SIP user, the SIP channel module hasn't been
loaded or the SIP or IAX peer is not registered currently.
ManagerCommunicationException
- if the originate action cannot be
sent to Asteriskvoid originateAsync(OriginateAction originateAction, OriginateCallback cb) throws ManagerCommunicationException
originateAction
- the action that contains parameters for the originatecb
- callback to inform about the result
ManagerCommunicationException
- if the originate action cannot be
sent to AsteriskAsteriskChannel originateToExtension(java.lang.String channel, java.lang.String context, java.lang.String exten, int priority, long timeout) throws ManagerCommunicationException, NoSuchChannelException
channel
- channel name to call, for example "SIP/1310".context
- context to connect toexten
- extension to connect topriority
- priority to connect totimeout
- how long to wait for the channel to be answered before its
considered to have failed (in ms)
NoSuchChannelException
- if the channel is not available on the
Asterisk server, for example because you used "SIP/1310" and 1310
is not a valid SIP user, the SIP channel module hasn't been
loaded or the SIP or IAX peer is not registered currently.
ManagerCommunicationException
- if the originate action cannot be
sent to AsteriskAsteriskChannel originateToExtension(java.lang.String channel, java.lang.String context, java.lang.String exten, int priority, long timeout, CallerId callerId, java.util.Map<java.lang.String,java.lang.String> variables) throws ManagerCommunicationException, NoSuchChannelException
channel
- channel name to call, for example "SIP/1310".context
- context to connect toexten
- extension to connect topriority
- priority to connect totimeout
- how long to wait for the channel to be answered before its
considered to have failed (in ms)callerId
- callerId to use for the outgoing channel, may be
null
.variables
- channel variables to set, may be null
.
NoSuchChannelException
- if the channel is not available on the
Asterisk server, for example because you used "SIP/1310" and 1310
is not a valid SIP user, the SIP channel module hasn't been
loaded or the SIP or IAX peer is not registered currently.
ManagerCommunicationException
- if the originate action cannot be
sent to AsteriskAsteriskChannel originateToApplication(java.lang.String channel, java.lang.String application, java.lang.String data, long timeout) throws ManagerCommunicationException, NoSuchChannelException
channel
- channel name to call, for example "SIP/1310".application
- application to connect to, for example "MeetMe"data
- data to pass to the application, for example "1000|d", may be
null
.timeout
- how long to wait for the channel to be answered before its
considered to have failed (in ms)
NoSuchChannelException
- if the channel is not available on the
Asterisk server, for example because you used "SIP/1310" and 1310
is not a valid SIP user, the SIP channel module hasn't been
loaded or the SIP or IAX peer is not registered currently.
ManagerCommunicationException
- if the originate action cannot be
sent to AsteriskAsteriskChannel originateToApplication(java.lang.String channel, java.lang.String application, java.lang.String data, long timeout, CallerId callerId, java.util.Map<java.lang.String,java.lang.String> variables) throws ManagerCommunicationException, NoSuchChannelException
channel
- channel name to call, for example "SIP/1310".application
- application to connect to, for example "MeetMe"data
- data to pass to the application, for example "1000|d", may be
null
.timeout
- how long to wait for the channel to be answered before its
considered to have failed (in ms)callerId
- callerId to use for the outgoing channel, may be
null
.variables
- channel variables to set, may be null
.
NoSuchChannelException
- if the channel is not available on the
Asterisk server, for example because you used "SIP/1310" and 1310
is not a valid SIP user, the SIP channel module hasn't been
loaded or the SIP or IAX peer is not registered currently.
ManagerCommunicationException
- if the originate action cannot be
sent to Asteriskvoid originateToExtensionAsync(java.lang.String channel, java.lang.String context, java.lang.String exten, int priority, long timeout, OriginateCallback callback) throws ManagerCommunicationException
channel
- channel name to call, for example "SIP/1310".context
- context to connect toexten
- extension to connect topriority
- priority to connect totimeout
- how long to wait for the channel to be answered before its
considered to have failed (in ms)callback
- callback to inform about the result
ManagerCommunicationException
- if the originate action cannot be
sent to Asteriskvoid originateToExtensionAsync(java.lang.String channel, java.lang.String context, java.lang.String exten, int priority, long timeout, CallerId callerId, java.util.Map<java.lang.String,java.lang.String> variables, OriginateCallback callback) throws ManagerCommunicationException
channel
- channel name to call, for example "SIP/1310".context
- context to connect toexten
- extension to connect topriority
- priority to connect totimeout
- how long to wait for the channel to be answered before its
considered to have failed (in ms)callerId
- callerId to use for the outgoing channel, may be
null
.variables
- channel variables to set, may be null
.callback
- callback to inform about the result
ManagerCommunicationException
- if the originate action cannot be
sent to Asteriskvoid originateToApplicationAsync(java.lang.String channel, java.lang.String application, java.lang.String data, long timeout, OriginateCallback callback) throws ManagerCommunicationException
channel
- channel name to call, for example "SIP/1310".application
- application to connect to, for example "MeetMe"data
- data to pass to the application, for example "1000|d", may be
null
.timeout
- how long to wait for the channel to be answered before its
considered to have failed (in ms)callback
- callback to inform about the result
ManagerCommunicationException
- if the originate action cannot be
sent to Asteriskvoid originateToApplicationAsync(java.lang.String channel, java.lang.String application, java.lang.String data, long timeout, CallerId callerId, java.util.Map<java.lang.String,java.lang.String> variables, OriginateCallback callback) throws ManagerCommunicationException
channel
- channel name to call, for example "SIP/1310".application
- application to connect to, for example "MeetMe"data
- data to pass to the application, for example "1000|d", may be
null
.timeout
- how long to wait for the channel to be answered before its
considered to have failed (in ms)callerId
- callerId to use for the outgoing channel, may be
null
.variables
- channel variables to set, may be null
.callback
- callback to inform about the result
ManagerCommunicationException
- if the originate action cannot be
sent to Asteriskjava.util.Collection<AsteriskChannel> getChannels() throws ManagerCommunicationException
ManagerCommunicationException
- if there is a problem communication
with AsteriskAsteriskChannel getChannelByName(java.lang.String name) throws ManagerCommunicationException
name
- name of the channel to return
null
if there
is no such channel.
ManagerCommunicationException
- if there is a problem communication
with AsteriskAsteriskChannel getChannelById(java.lang.String id) throws ManagerCommunicationException
id
- the unique id of the channel to return
null
if
there is no such channel.
ManagerCommunicationException
- if there is a problem communication
with Asteriskjava.util.Collection<MeetMeRoom> getMeetMeRooms() throws ManagerCommunicationException
ManagerCommunicationException
- if there is a problem communication
with AsteriskMeetMeRoom getMeetMeRoom(java.lang.String roomNumber) throws ManagerCommunicationException
MeetMeRoom
object is created.
roomNumber
- the number of the room to return
ManagerCommunicationException
- if there is a problem communication
with Asteriskjava.util.Collection<AsteriskQueue> getQueues() throws ManagerCommunicationException
ManagerCommunicationException
- if there is a problem communication
with Asteriskjava.util.Collection<AsteriskAgent> getAgents() throws ManagerCommunicationException
AsteriskAgent
)
ManagerCommunicationException
- if there is a problem communication
with Asteriskjava.lang.String getVersion() throws ManagerCommunicationException
ManagerCommunicationException
- if the version cannot be retrieved
from Asteriskint[] getVersion(java.lang.String file) throws ManagerCommunicationException
file
- the file for which to get the version like "app_meetme.c"
null
if that file
is not part of the Asterisk instance you are connected to (maybe
due to a module that provides it has not been loaded) or if you
are connected to an Astersion 1.0.x
ManagerCommunicationException
- if the version cannot be retrieved
from Asteriskjava.lang.String getGlobalVariable(java.lang.String variable) throws ManagerCommunicationException
variable
- the name of the global variable to return.
null
if it is
not set.
ManagerCommunicationException
- if the get variable action cannot
be sent to Asterisk.void setGlobalVariable(java.lang.String variable, java.lang.String value) throws ManagerCommunicationException
variable
- the name of the global variable to set.value
- the value of the global variable to set.
ManagerCommunicationException
- if the set variable action cannot
be sent to Asterisk.java.util.Collection<Voicemailbox> getVoicemailboxes() throws ManagerCommunicationException
ManagerCommunicationException
- if the voicemailboxes can't be
retrieved.java.util.List<java.lang.String> executeCliCommand(java.lang.String command) throws ManagerCommunicationException
command
- the command to execute, for example "sip show peers".
ManagerCommunicationException
- if the command can't be executed.CommandAction
boolean isModuleLoaded(java.lang.String module) throws ManagerCommunicationException
Available since Asterisk 1.6
module
- name of the module to load (with out without the ".so" extension).
true
if the module is currently loaded, false
otherwise.
ManagerCommunicationException
- if the module can't be checked.void loadModule(java.lang.String module) throws ManagerCommunicationException
Available since Asterisk 1.6
module
- name of the module to load (including ".so" extension) or subsystem name.
ManagerCommunicationException
- if the module cannot be loaded.void unloadModule(java.lang.String module) throws ManagerCommunicationException
Available since Asterisk 1.6
module
- name of the module to unload (including ".so" extension) or subsystem name.
ManagerCommunicationException
- if the module cannot be unloaded.void reloadModule(java.lang.String module) throws ManagerCommunicationException
Available since Asterisk 1.6
module
- name of the module to reload (including ".so" extension) or subsystem name.
ManagerCommunicationException
- if the module cannot be reloaded.void reloadAllModules() throws ManagerCommunicationException
Available since Asterisk 1.6
ManagerCommunicationException
- if the modules cannot be reloaded.ConfigFile getConfig(java.lang.String filename) throws ManagerCommunicationException
filename
- the filename, for example "voicemail.conf".
ManagerCommunicationException
- if the command can't be executed.void addAsteriskServerListener(AsteriskServerListener listener) throws ManagerCommunicationException
listener
- the listener to add.
ManagerCommunicationException
- if the server is not yet connected
and the connection or initialization fails.void removeAsteriskServerListener(AsteriskServerListener listener)
listener
- the listener to remove.void shutdown()
void initialize() throws ManagerCommunicationException
ManagerCommunicationException
- if login fails
|
Asterisk-Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |