1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.asterisk.fastagi.command;
18
19 /***
20 * Returns the value of the given channel varible.<br>
21 * Since Asterisk 1.2 you can also use this command to use custom Asterisk
22 * functions. Syntax is "func(args)".<br>
23 * Returns 0 if the variable is not set. Returns 1 if the variable is set and
24 * returns the variable in parenthesis.<br>
25 * Example return code: 200 result=1 (testvariable)
26 *
27 * @author srt
28 * @version $Id: GetVariableCommand.java,v 1.6 2005/11/08 21:11:31 srt Exp $
29 */
30 public class GetVariableCommand extends AGICommand
31 {
32 /***
33 * Serial version identifier.
34 */
35 private static final long serialVersionUID = 3256719598056387384L;
36
37 /***
38 * The name of the variable to retrieve.
39 */
40 private String variable;
41
42 /***
43 * Creates a new GetVariableCommand.
44 *
45 * @param variable the name of the variable to retrieve.
46 */
47 public GetVariableCommand(String variable)
48 {
49 this.variable = variable;
50 }
51
52 /***
53 * Returns the name of the variable to retrieve.
54 *
55 * @return the the name of the variable to retrieve.
56 */
57 public String getVariable()
58 {
59 return variable;
60 }
61
62 /***
63 * Sets the name of the variable to retrieve.<br>
64 * Since Asterisk 1.2 you can also use custom dialplan functions (like
65 * "func(args)") as variable.
66 *
67 * @param variable the name of the variable to retrieve.
68 */
69 public void setVariable(String variable)
70 {
71 this.variable = variable;
72 }
73
74 public String buildCommand()
75 {
76 return "GET VARIABLE " + escapeAndQuote(variable);
77 }
78 }