1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.asterisk.fastagi;
18
19 import java.net.InetAddress;
20 import java.util.Map;
21
22 /***
23 * Defines an object to provide client request information to an AGIScript.<br>
24 * This includes information about the channel the script is invoked on and
25 * parameters passed from the dialplan.
26 *
27 * @author srt
28 * @version $Id: AGIRequest.java,v 1.10 2005/11/27 16:08:17 srt Exp $
29 */
30 public interface AGIRequest
31 {
32 /***
33 * Returns a Map containing the raw request name/value pairs.
34 *
35 * @return Map contain raw request name/value pairs.
36 */
37 Map getRequest();
38
39 /***
40 * Returns the name of the script to execute including its full path.<br>
41 * This corresponds to the request url with protocol, host, port and
42 * parameters stripped off.
43 *
44 * @return the name of the script to execute.
45 */
46 String getScript();
47
48 /***
49 * Returns the full URL of the requestURL in the form
50 * agi://host[:port][/script][?param1=value1¶m2=value2].
51 *
52 * @return the full URL of the requestURL in the form
53 * agi://host[:port][/script][?param1=value1¶m2=value2].
54 */
55 String getRequestURL();
56
57 /***
58 * Returns the name of the channel.
59 *
60 * @return the name of the channel.
61 */
62 String getChannel();
63
64 /***
65 * Returns the unqiue id of the channel.
66 *
67 * @return the unqiue id of the channel.
68 */
69 String getUniqueId();
70
71 /***
72 * Returns the type of the channel, for example "SIP".
73 *
74 * @return the type of the channel, for example "SIP".
75 */
76 String getType();
77
78 /***
79 * Returns the language, for example "en".
80 *
81 * @return the language, for example "en".
82 */
83 String getLanguage();
84
85 /***
86 * Returns the Caller*ID, for example "1234".
87 *
88 * @return the Caller*ID, for example "1234", if no Caller*ID is set or it
89 * is "unknown" <code>null</code> is returned.
90 */
91 String getCallerId();
92
93 /***
94 * Returns the the Caller*ID Name, for example "John Doe".
95 *
96 * @return the the Caller*ID Name, for example "John Doe", if no Caller*ID
97 * Name is set or it is "unknown" <code>null</code> is returned.
98 */
99 String getCallerIdName();
100
101 /***
102 * Returns the number, that has been dialed by the user.
103 *
104 * @return the dialed number, if no DNID is available or it is "unknown"
105 * <code>null</code> is returned.
106 */
107 String getDnid();
108
109 /***
110 * If this call has been forwared, the number of the person doing the
111 * redirect is returned (Redirected dialed number identification service).<br>
112 * This is usally only only available on PRI.
113 *
114 * @return the number of the person doing the redirect, , if no RDNIS is
115 * available or it is "unknown" <code>null</code> is returned.
116 */
117 String getRdnis();
118
119 /***
120 * Returns the context in the dial plan from which the AGI script was
121 * called.
122 *
123 * @return the context in the dial plan from which the AGI script was
124 * called.
125 */
126 String getContext();
127
128 /***
129 * Returns the extension in the dial plan from which the AGI script was
130 * called.
131 *
132 * @return the extension in the dial plan from which the AGI script was
133 * called.
134 */
135 String getExtension();
136
137 /***
138 * Returns the priority in the dial plan from which the AGI script was
139 * called.
140 *
141 * @return the priority in the dial plan from which the AGI script was
142 * called.
143 */
144 Integer getPriority();
145
146 /***
147 * Returns wheather this agi is passed audio (EAGI - Enhanced AGI).<br>
148 * Enhanced AGI is currently not supported on FastAGI.
149 *
150 * @return Boolean.TRUE if this agi is passed audio, Boolean.FALSE
151 * otherwise.
152 */
153 Boolean getEnhanced();
154
155 /***
156 * Returns the account code set for the call.
157 *
158 * @return the account code set for the call.
159 */
160 String getAccountCode();
161
162 /***
163 * Returns the Callerid presentation/screening.<br>
164 * Available since Asterisk 1.2.
165 *
166 * @return the Callerid presentation/screening.
167 * @since 0.2
168 */
169 Integer getCallingPres();
170
171 /***
172 * Returns the Callerid ANI 2 (Info digits).<br>
173 * Available since Asterisk 1.2.
174 *
175 * @return the Callerid ANI 2 (Info digits).
176 * @since 0.2
177 */
178 Integer getCallingAni2();
179
180 /***
181 * Returns the Callerid Type of Number.<br>
182 * Available since Asterisk 1.2.
183 *
184 * @return the Callerid Type of Number.
185 * @since 0.2
186 */
187 Integer getCallingTon();
188
189 /***
190 * Returns the Callerid Transit Network Select.<br>
191 * Available since Asterisk 1.2.
192 *
193 * @return the Callerid Transit Network Select.
194 * @since 0.2
195 */
196 Integer getCallingTns();
197
198 /***
199 * Returns the value of a request parameter as a String, or
200 * <code>null</code> if the parameter does not exist. You should only use
201 * this method when you are sure the parameter has only one value.<br>
202 * If the parameter might have more than one value, use
203 * {@link #getParameterValues(String)}.<br>
204 * If you use this method with a multivalued parameter, the value returned
205 * is equal to the first value in the array returned by
206 * <code>getParameterValues</code>.
207 *
208 * @param name a String containing the name of the parameter whose value is
209 * requested.
210 * @return a String representing the single value of the parameter.
211 * @see #getParameterValues(String)
212 */
213 String getParameter(String name);
214
215 /***
216 * Returns an array of String objects containing all of the values the given
217 * request parameter has, or
218 * <code>null</coder> if the parameter does not exist.<br>
219 * If the parameter has a single value, the array has a length of 1.
220 *
221 * @param name a String containing the name of the parameter whose value is requested.
222 * @return an array of String objects containing the parameter's values.
223 */
224 String[] getParameterValues(String name);
225
226 /***
227 * Returns a java.util.Map of the parameters of this request.
228 *
229 * @return a java.util.Map containing parameter names as keys and parameter
230 * values as map values. The keys in the parameter map are of type
231 * String. The values in the parameter map are of type String array.
232 */
233 Map getParameterMap();
234
235 /***
236 * Returns the local address this channel, that is the IP address of the AGI
237 * server.
238 *
239 * @return the local address this channel.
240 * @since 0.2
241 */
242 InetAddress getLocalAddress();
243
244 /***
245 * Returns the local port of this channel, that is the port the AGI server
246 * is listening on.
247 *
248 * @return the local port of this socket channel.
249 * @since 0.2
250 */
251 int getLocalPort();
252
253 /***
254 * Returns the remote address of this channel, that is the IP address of the
255 * Asterisk server.
256 *
257 * @return the remote address of this channel.
258 * @since 0.2
259 */
260 InetAddress getRemoteAddress();
261
262 /***
263 * Returns the remote port of this channel, that is the client port the
264 * Asterisk server is using for the AGI connection.
265 *
266 * @return the remote port of this channel.
267 * @since 0.2
268 */
269 int getRemotePort();
270 }