1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.asterisk.manager.action;
18
19 /***
20 * The MonitorAction starts monitoring (recording) a channel.<br>
21 * It is implemented in <code>res/res_monitor.c</code>
22 *
23 * @author srt
24 * @version $Id: MonitorAction.java,v 1.4 2005/08/07 16:43:29 srt Exp $
25 */
26 public class MonitorAction extends AbstractManagerAction
27 {
28 /***
29 * Serializable version identifier
30 */
31 private static final long serialVersionUID = 6840975934278794758L;
32 private String channel;
33 private String file;
34 private String format;
35 private Boolean mix;
36
37 /***
38 * Creates a new empty MonitorAction.
39 */
40 public MonitorAction()
41 {
42
43 }
44
45 /***
46 * Creates a new MonitorAction that starts monitoring the given channel and
47 * writes voice data to the given file(s).
48 *
49 * @param channel the name of the channel to monitor
50 * @param file the (base) name of the file(s) to which the voice data is
51 * written
52 * @since 0.2
53 */
54 public MonitorAction(String channel, String file)
55 {
56 this.channel = channel;
57 this.file = file;
58 }
59
60 /***
61 * Creates a new MonitorAction that starts monitoring the given channel and
62 * writes voice data to the given file(s).
63 *
64 * @param channel the name of the channel to monitor
65 * @param file the (base) name of the file(s) to which the voice data is
66 * written
67 * @param format the format to use for encoding the voice files
68 * @since 0.2
69 */
70 public MonitorAction(String channel, String file, String format)
71 {
72 this.channel = channel;
73 this.file = file;
74 this.format = format;
75 }
76
77 /***
78 * Creates a new MonitorAction that starts monitoring the given channel and
79 * writes voice data to the given file(s).
80 *
81 * @param channel the name of the channel to monitor
82 * @param file the (base) name of the file(s) to which the voice data is
83 * written
84 * @param format the format to use for encoding the voice files
85 * @param mix true if the two voice files should be joined at the end of the
86 * call
87 * @since 0.2
88 */
89 public MonitorAction(String channel, String file, String format, Boolean mix)
90 {
91 this.channel = channel;
92 this.file = file;
93 this.format = format;
94 this.mix = mix;
95 }
96
97 /***
98 * Returns the name of this action, i.e. "Monitor".
99 */
100 public String getAction()
101 {
102 return "Monitor";
103 }
104
105 /***
106 * Returns the name of the channel to monitor.
107 */
108 public String getChannel()
109 {
110 return channel;
111 }
112
113 /***
114 * Sets the name of the channel to monitor.<br>
115 * This property is mandatory.
116 */
117 public void setChannel(String channel)
118 {
119 this.channel = channel;
120 }
121
122 /***
123 * Returns the name of the file to which the voice data is written.
124 */
125 public String getFile()
126 {
127 return file;
128 }
129
130 /***
131 * Sets the (base) name of the file(s) to which the voice data is written.<br>
132 * If this property is not set it defaults to to the channel name as per CLI
133 * with the '/' replaced by '-'.
134 */
135 public void setFile(String file)
136 {
137 this.file = file;
138 }
139
140 /***
141 * Returns the format to use for encoding the voice files.
142 */
143 public String getFormat()
144 {
145 return format;
146 }
147
148 /***
149 * Sets the format to use for encoding the voice files.<br>
150 * If this property is not set it defaults to "wav".
151 */
152 public void setFormat(String format)
153 {
154 this.format = format;
155 }
156
157 /***
158 * Returns true if the two voice files should be joined at the end of the
159 * call.
160 */
161 public Boolean getMix()
162 {
163 return mix;
164 }
165
166 /***
167 * Set to true if the two voice files should be joined at the end of the
168 * call.
169 */
170 public void setMix(Boolean mix)
171 {
172 this.mix = mix;
173 }
174 }