net.sf.asterisk.manager
Class MultiAsterisksManager

java.lang.Object
  extended by net.sf.asterisk.manager.MultiAsterisksManager
All Implemented Interfaces:
java.util.EventListener, AsteriskManager, ManagerEventHandler

public class MultiAsterisksManager
extends java.lang.Object
implements AsteriskManager, ManagerEventHandler

Author:
PY

Constructor Summary
MultiAsterisksManager()
           
 
Method Summary
protected  void addChannel(Channel channel)
           
 void addManagerConnection(ManagerConnection connection)
           
protected  void addQueue(Queue queue)
           
protected  void dispatchEvent(ManagerEvent event)
           
 java.util.Map getChannels()
          Returns a map of all active channel by their unique id: "hostname:ChannelId".
 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.
 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 handleLinkEvent(LinkEvent 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 handleStatusCompleteEvent(StatusCompleteEvent event)
           
protected  void handleStatusEvent(StatusEvent event)
           
protected  void handleUnlinkEvent(UnlinkEvent event)
           
 void initialize()
           
 Call originateCall(Originate originate)
          Generates an outgoing call.
protected  void removeChannel(Channel channel)
           
protected  void removeQueue(Queue queue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiAsterisksManager

public MultiAsterisksManager()
Method Detail

addManagerConnection

public void addManagerConnection(ManagerConnection connection)

initialize

public void initialize()
                throws TimeoutException,
                       java.io.IOException,
                       AuthenticationFailedException
Throws:
TimeoutException
java.io.IOException
AuthenticationFailedException

getChannels

public java.util.Map getChannels()
Returns a map of all active channel by their unique id: "hostname:ChannelId".

Specified by:
getChannels in interface AsteriskManager
Returns:
a Map of active channels.

getQueues

public java.util.Map getQueues()
Description copied from interface: AsteriskManager
Returns a Map of all queues.
The map contains the queue names as keys and objects of type Queue as values.

Specified by:
getQueues in interface AsteriskManager
Returns:
a Map of queues.

handleEvent

public 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.

Specified by:
handleEvent in interface ManagerEventHandler
Parameters:
event - the event received

dispatchEvent

protected void dispatchEvent(ManagerEvent event)

addChannel

protected void addChannel(Channel channel)

removeChannel

protected void removeChannel(Channel channel)

addQueue

protected void addQueue(Queue queue)

removeQueue

protected void removeQueue(Queue queue)

handleStatusEvent

protected void handleStatusEvent(StatusEvent event)

handleStatusCompleteEvent

protected void handleStatusCompleteEvent(StatusCompleteEvent event)

handleQueueParamsEvent

protected void handleQueueParamsEvent(QueueParamsEvent event)

handleQueueMemberEvent

protected void handleQueueMemberEvent(QueueMemberEvent event)

handleQueueEntryEvent

protected void handleQueueEntryEvent(QueueEntryEvent event)

handleNewChannelEvent

protected void handleNewChannelEvent(NewChannelEvent event)

handleNewExtenEvent

protected void handleNewExtenEvent(NewExtenEvent event)

handleNewStateEvent

protected void handleNewStateEvent(NewStateEvent event)

handleHangupEvent

protected void handleHangupEvent(HangupEvent event)

handleLinkEvent

protected void handleLinkEvent(LinkEvent event)

handleUnlinkEvent

protected void handleUnlinkEvent(UnlinkEvent event)

handleRenameEvent

protected void handleRenameEvent(RenameEvent event)

originateCall

public Call originateCall(Originate originate)
                   throws TimeoutException,
                          java.io.IOException
Description copied from interface: AsteriskManager
Generates an outgoing call.

Specified by:
originateCall in interface AsteriskManager
Parameters:
originate - conatins the details of the call to originate
Returns:
a Call object representing the originated call
Throws:
TimeoutException - if the originated call is not answered in time
java.io.IOException - if the action cannot be sent to the asterisk server

getVersion

public int[] getVersion(java.lang.String file)
Description copied from interface: AsteriskManager
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.

Specified by:
getVersion in interface AsteriskManager
Parameters:
file - the file for which to get the version like "app_meetme.c"
Returns:
the CVS revision of the file, or 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

getVersion

public java.lang.String getVersion()
Description copied from interface: AsteriskManager
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".

Specified by:
getVersion in interface AsteriskManager
Returns:
the version of the Asterisk server you are connected to


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.