View Javadoc

1   /*
2    * Copyright  2004-2005 Stefan Reuter
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  package net.sf.asterisk.manager;
18  
19  import java.io.IOException;
20  import java.util.Map;
21  
22  /***
23   * The AsteriskManager is built on top of the ManagerConnection and is an
24   * attempt to simplify interaction with Asterisk by abstracting the interface.<br>
25   * You will certainly have less freedom using AsteriskManager but it will make
26   * life easier for easy things (like originating a call or getting a list of
27   * open channels).<br>
28   * AsteriskManager is still in an early state of development. So, when using
29   * AsteriskManager be aware that it might change in the future.
30   * 
31   * @author srt
32   * @version $Id: AsteriskManager.java,v 1.9 2005/07/27 23:38:14 srt Exp $
33   */
34  public interface AsteriskManager
35  {
36      /***
37       * Generates an outgoing call.
38       * 
39       * @param originate conatins the details of the call to originate
40       * @return a Call object representing the originated call
41       * @throws TimeoutException if the originated call is not answered in time
42       * @throws IOException if the action cannot be sent to the asterisk server
43       */
44      public Call originateCall(Originate originate) throws TimeoutException,
45              IOException;
46  
47      /***
48       * Returns a Map of active channels.<br>
49       * The map contain the channel names as keys and objects of type
50       * {@link net.sf.asterisk.manager.Channel} as values.
51       * 
52       * @return a Map of active channels.
53       */
54      Map getChannels();
55  
56      /***
57       * Returns a Map of all queues.<br>
58       * The map contains the queue names as keys and objects of type
59       * {@link Queue} as values.
60       * 
61       * @return a Map of queues.
62       */
63      Map getQueues();
64  
65      /***
66       * Returns the version of the Asterisk server you are connected to.<br>
67       * This typically looks like "Asterisk 1.0.9 built by root@host on a i686
68       * running Linux".
69       * 
70       * @return the version of the Asterisk server you are connected to
71       * @since 0.2
72       */
73      String getVersion();
74  
75      /***
76       * Returns the CVS revision of a given source file of the Asterisk server
77       * you are connected to.<br>
78       * For example getVersion("app_meetme.c") may return {1, 102} for CVS
79       * revision "1.102".<br>
80       * Note that this feature is not available with Asterisk 1.0.x.<br>
81       * You can use this feature if you need to write applications that behave
82       * different depending on specific modules being available in a specific
83       * version or not.
84       * 
85       * @param file the file for which to get the version like "app_meetme.c"
86       * @return the CVS revision of the file, or <code>null</code> if that file
87       *         is not part of the Asterisk instance you are connected to (maybe
88       *         due to a module that provides it has not been loaded) or if you
89       *         are connected to an Astersion 1.0.x
90       * @since 0.2
91       */
92      int[] getVersion(String file);
93  }