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 * Receives a string of text on a channel.<br>
21 * Specify timeout to be the maximum time to wait for input in milliseconds, or
22 * 0 for infinite.<br>
23 * Most channels do not support the reception of text.<br>
24 * Returns -1 for failure or 1 for success, and the string in parentheses.<br>
25 * Available since Asterisk 1.2.
26 *
27 * @since 0.2
28 * @author srt
29 * @version $Id: ReceiveTextCommand.java,v 1.1 2005/11/27 15:22:40 srt Exp $
30 */
31 public class ReceiveTextCommand extends AGICommand
32 {
33 /***
34 * Serial version identifier.
35 */
36 private static final long serialVersionUID = 3256719598056387384L;
37
38 /***
39 * The milliseconds to wait for the channel to receive a character.
40 */
41 private int timeout;
42
43 /***
44 * Creates a new ReceiveTextCommand with a default timeout of 0 meaning to
45 * wait for ever.
46 */
47 public ReceiveTextCommand()
48 {
49 this.timeout = 0;
50 }
51
52 /***
53 * Creates a new ReceiveTextCommand.
54 *
55 * @param timeout the milliseconds to wait for the channel to receive the
56 * text.
57 */
58 public ReceiveTextCommand(int timeout)
59 {
60 this.timeout = timeout;
61 }
62
63 /***
64 * Returns the milliseconds to wait for the channel to receive the text.
65 *
66 * @return the milliseconds to wait for the channel to receive the text.
67 */
68 public int getTimeout()
69 {
70 return timeout;
71 }
72
73 /***
74 * Sets the milliseconds to wait for the channel to receive the text.
75 *
76 * @param timeout the milliseconds to wait for the channel to receive the
77 * text.
78 */
79 public void setTimeout(int timeout)
80 {
81 this.timeout = timeout;
82 }
83
84 public String buildCommand()
85 {
86 return "RECEIVE TEXT " + timeout;
87 }
88 }