1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package net.sf.asterisk.manager;
19
20 import java.util.*;
21
22 /***
23 * @author Ben Hencke
24 */
25 public class Originate
26 {
27 private String channel;
28 private String exten;
29 private String context;
30 private Integer priority;
31 private Long timeout;
32 private String callerId;
33 private Map variables = new HashMap();
34 private String account;
35 private String application;
36 private String data;
37
38 /***
39 * Returns the account code to use for the originated call.
40 */
41 public String getAccount()
42 {
43 return account;
44 }
45
46 /***
47 * Sets the account code to use for the originated call.<br>
48 * The account code is included in the call detail record generated for this
49 * call and will be used for billing.
50 */
51 public void setAccount(String account)
52 {
53 this.account = account;
54 }
55
56 /***
57 * Returns the caller id to set on the outgoing channel.
58 */
59 public String getCallerId()
60 {
61 return callerId;
62 }
63
64 /***
65 * Sets the caller id to set on the outgoing channel.
66 */
67 public void setCallerId(String callerId)
68 {
69 this.callerId = callerId;
70 }
71
72 /***
73 * Returns the name of the channel to connect to the outgoing call.
74 */
75 public String getChannel()
76 {
77 return channel;
78 }
79
80 /***
81 * Sets the name of the channel to connect to the outgoing call.<br>
82 * This property is required.
83 */
84 public void setChannel(String channel)
85 {
86 this.channel = channel;
87 }
88
89 /***
90 * Returns the name of the context of the extension to connect to.
91 */
92 public String getContext()
93 {
94 return context;
95 }
96
97 /***
98 * Sets the name of the context of the extension to connect to.<br>
99 * If you set the context you also have to set the exten and priority
100 * properties.
101 */
102 public void setContext(String context)
103 {
104 this.context = context;
105 }
106
107 /***
108 * Returns the extension to connect to.
109 */
110 public String getExten()
111 {
112 return exten;
113 }
114
115 /***
116 * Sets the extension to connect to.<br>
117 * If you set the extension you also have to set the context and priority
118 * properties.
119 */
120 public void setExten(String exten)
121 {
122 this.exten = exten;
123 }
124
125 /***
126 * Returns the priority of the extension to connect to.
127 */
128 public Integer getPriority()
129 {
130 return priority;
131 }
132
133 /***
134 * Sets the priority of the extension to connect to. If you set the priority
135 * you also have to set the context and exten properties.
136 */
137 public void setPriority(Integer priority)
138 {
139 this.priority = priority;
140 }
141
142 /***
143 * Returns the name of the application to connect to.
144 */
145 public String getApplication()
146 {
147 return application;
148 }
149
150 /***
151 * Sets the name of the application to connect to.
152 */
153 public void setApplication(String application)
154 {
155 this.application = application;
156 }
157
158 /***
159 * Returns the parameters to pass to the application.
160 */
161 public String getData()
162 {
163 return data;
164 }
165
166 /***
167 * Sets the parameters to pass to the application.
168 */
169 public void setData(String data)
170 {
171 this.data = data;
172 }
173
174 /***
175 * Returns the timeout for the origination.
176 */
177 public Long getTimeout()
178 {
179 return timeout;
180 }
181
182 /***
183 * Sets the timeout (in milliseconds) for the origination.<br>
184 * The channel must be answered within this time, otherwise the origination
185 * is considered to have failed and an OriginateFailureEvent is generated.<br>
186 * If not set, a default value of 30000 is asumed meaning 30 seconds.
187 */
188 public void setTimeout(Long timeout)
189 {
190 this.timeout = timeout;
191 }
192
193 /***
194 * Returns the variables to set on the originated call.
195 */
196 public Map getVariables()
197 {
198 return variables;
199 }
200
201 /***
202 * Sets the variables to set on the originated call.
203 */
204 public void setVariables(Map variables)
205 {
206 this.variables = variables;
207 }
208
209 /***
210 * Sets a variable on the originated call. Replaces any existing variable
211 * with the same name.
212 */
213 public void setVariable(String name, String value)
214 {
215 variables.put(name, value);
216 }
217
218 /***
219 * Returns the variables to set on the originated call in native asterisk
220 * format.<br>
221 * Example: "VAR1=abc|VAR2=def".
222 *
223 * @deprecated This method is no longer needed and will be removed in the
224 * next version of Asterisk-Java.
225 */
226 public String getVariableString()
227 {
228 StringBuffer varstring = new StringBuffer();
229 Iterator i = variables.entrySet().iterator();
230 while (i.hasNext())
231 {
232 Map.Entry var = (Map.Entry) i.next();
233 varstring.append(var.getKey());
234 varstring.append("|");
235 varstring.append(var.getValue());
236 }
237
238 return varstring.toString();
239 }
240 }