|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.asterisk.manager.DefaultAsteriskManager
public class DefaultAsteriskManager
Default implementation of the AsteriskManager interface.
AsteriskManager
Constructor Summary | |
---|---|
DefaultAsteriskManager()
Creates a new instance. |
|
DefaultAsteriskManager(ManagerConnection connection)
Creates a new instance. |
Method Summary | |
---|---|
protected void |
addChannel(Channel channel)
|
protected void |
addQueue(Queue queue)
|
Channel |
getChannelById(java.lang.String id)
Returns a channel by its unique id. |
Channel |
getChannelByName(java.lang.String name)
Returns a channel by its name. |
java.util.Map |
getChannels()
Returns a map of all active channel by their unique id. |
java.util.Map |
getQueues()
Returns a Map of all queues. The map contains the queue names as keys and objects of type Queue as values. |
java.lang.String |
getVersion()
Returns the version of the Asterisk server you are connected to. This typically looks like "Asterisk 1.0.9 built by root@host on a i686 running Linux". |
int[] |
getVersion(java.lang.String file)
Returns the CVS revision of a given source file of the Asterisk server you are connected to. For example getVersion("app_meetme.c") may return {1, 102} for CVS revision "1.102". Note that this feature is not available with Asterisk 1.0.x. You can use this feature if you need to write applications that behave different depending on specific modules being available in a specific version or not. |
protected void |
handleConnectEvent(ConnectEvent connectEvent)
Requests the current state from the asterisk server after the connection to the asterisk server is restored. |
protected void |
handleDisconnectEvent(DisconnectEvent disconnectEvent)
Resets the internal state when the connection to the asterisk server is lost. |
void |
handleEvent(ManagerEvent event)
Handles all events received from the asterisk server. Events are queued until channels and queues are initialized and then delegated to the dispatchEvent method. |
protected void |
handleHangupEvent(HangupEvent event)
|
protected void |
handleJoinEvent(JoinEvent event)
|
protected void |
handleLeaveEvent(LeaveEvent event)
|
protected void |
handleLinkEvent(LinkEvent event)
|
protected void |
handleNewCallerIdEvent(NewCallerIdEvent event)
|
protected void |
handleNewChannelEvent(NewChannelEvent event)
|
protected void |
handleNewExtenEvent(NewExtenEvent event)
|
protected void |
handleNewStateEvent(NewStateEvent event)
|
protected void |
handleQueueEntryEvent(QueueEntryEvent event)
|
protected void |
handleQueueMemberEvent(QueueMemberEvent event)
|
protected void |
handleQueueParamsEvent(QueueParamsEvent event)
|
protected void |
handleRenameEvent(RenameEvent event)
|
protected void |
handleStatusEvent(StatusEvent event)
|
protected void |
handleUnlinkEvent(UnlinkEvent event)
|
void |
initialize()
|
Call |
originateCall(Originate originate)
Generates an outgoing call. |
protected Call |
originateEvent2Call(OriginateEvent event)
|
protected void |
removeChannel(Channel channel)
|
protected void |
removeQueue(Queue queue)
|
void |
setManagerConnection(ManagerConnection connection)
|
void |
setSkipQueues(boolean skipQueues)
Determines if queue status is retrieved at startup. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultAsteriskManager()
public DefaultAsteriskManager(ManagerConnection connection)
connection
- the manager connection to useMethod Detail |
---|
public void setSkipQueues(boolean skipQueues)
true
to circumvent the startup delay caused by the missing
QueueStatusComplete event.false
.
skipQueues
- true
to skip queue initialization,
false
to not skip.public void setManagerConnection(ManagerConnection connection)
public void initialize() throws TimeoutException, java.io.IOException, AuthenticationFailedException
TimeoutException
java.io.IOException
AuthenticationFailedException
public Call originateCall(Originate originate) throws TimeoutException, java.io.IOException
AsteriskManager
originateCall
in interface AsteriskManager
originate
- conatins the details of the call to originate
TimeoutException
- if the originated call is not answered in time
java.io.IOException
- if the action cannot be sent to the asterisk serverpublic java.util.Map getChannels()
getChannels
in interface AsteriskManager
public java.util.Map getQueues()
AsteriskManager
Queue
as values.
getQueues
in interface AsteriskManager
public java.lang.String getVersion()
AsteriskManager
getVersion
in interface AsteriskManager
public int[] getVersion(java.lang.String file)
AsteriskManager
getVersion
in interface AsteriskManager
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.xpublic void handleEvent(ManagerEvent event)
handleEvent
in interface ManagerEventHandler
event
- the event receivedprotected void addChannel(Channel channel)
protected void removeChannel(Channel channel)
protected void addQueue(Queue queue)
protected void removeQueue(Queue queue)
protected void handleStatusEvent(StatusEvent event)
protected void handleDisconnectEvent(DisconnectEvent disconnectEvent)
protected void handleConnectEvent(ConnectEvent connectEvent)
protected void handleQueueParamsEvent(QueueParamsEvent event)
protected void handleQueueMemberEvent(QueueMemberEvent event)
protected void handleQueueEntryEvent(QueueEntryEvent event)
protected void handleJoinEvent(JoinEvent event)
protected void handleLeaveEvent(LeaveEvent event)
public Channel getChannelByName(java.lang.String name)
name
- name of the channel to return
public Channel getChannelById(java.lang.String id)
id
- the unique id of the channel to return
protected void handleNewChannelEvent(NewChannelEvent event)
protected void handleNewExtenEvent(NewExtenEvent event)
protected void handleNewStateEvent(NewStateEvent event)
protected void handleNewCallerIdEvent(NewCallerIdEvent event)
protected void handleHangupEvent(HangupEvent event)
protected void handleLinkEvent(LinkEvent event)
protected void handleUnlinkEvent(UnlinkEvent event)
protected void handleRenameEvent(RenameEvent event)
protected Call originateEvent2Call(OriginateEvent event)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |