View Javadoc

1   /*
2    * Copyright  2004-2005 Stefan Reuter
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  package net.sf.asterisk.fastagi.command;
18  
19  /***
20   * Sends the given text on a channel.<br>
21   * Most channels do not support the transmission of text.<br>
22   * Returns 0 if text is sent, or if the channel does not support text
23   * transmission. Returns -1 only on error/hangup.
24   * 
25   * @author srt
26   * @version $Id: SendTextCommand.java,v 1.2 2005/03/08 16:48:34 srt Exp $
27   */
28  public class SendTextCommand extends AGICommand
29  {
30      /***
31       * Serial version identifier.
32       */
33      private static final long serialVersionUID = 3904959746380281145L;
34  
35      /***
36       * The text to send.
37       */
38      private String text;
39  
40      /***
41       * Creates a new SendTextCommand.
42       * 
43       * @param text the text to send.
44       */
45      public SendTextCommand(String text)
46      {
47          this.text = text;
48      }
49  
50      /***
51       * Returns the text to send.
52       * 
53       * @return the text to send.
54       */
55      public String getText()
56      {
57          return text;
58      }
59  
60      /***
61       * Sets the text to send.
62       * 
63       * @param text the text to send.
64       */
65      public void setText(String text)
66      {
67          this.text = text;
68      }
69  
70      public String buildCommand()
71      {
72          return "SEND TEXT " + escapeAndQuote(text);
73      }
74  }