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   * Cause the channel to automatically hangup at the given number of seconds in
21   * the future.<br>
22   * Of course it can be hungup before then as well. Setting to 0 will cause the
23   * autohangup feature to be disabled on this channel.
24   * 
25   * @author srt
26   * @version $Id: SetAutoHangupCommand.java,v 1.3 2005/03/10 21:48:11 srt Exp $
27   */
28  public class SetAutoHangupCommand extends AGICommand
29  {
30      /***
31       * Serial version identifier.
32       */
33      private static final long serialVersionUID = 3257562923458443314L;
34  
35      /***
36       * The number of seconds before this channel is automatically hung up.
37       */
38      private int time;
39  
40      /***
41       * Creates a new SetAutoHangupCommand.
42       * 
43       * @param time the number of seconds before this channel is automatically
44       *            hung up.<br>
45       *            0 disables the autohangup feature.
46       */
47      public SetAutoHangupCommand(int time)
48      {
49          this.time = time;
50      }
51  
52      /***
53       * Returns the number of seconds before this channel is automatically hung
54       * up.
55       * 
56       * @return the number of seconds before this channel is automatically hung
57       *         up.
58       */
59      public int getTime()
60      {
61          return time;
62      }
63  
64      /***
65       * Sets the number of seconds before this channel is automatically hung up.
66       * 
67       * @param time the number of seconds before this channel is automatically
68       *            hung up.<br>
69       *            0 disables the autohangup feature.
70       */
71      public void setTime(int time)
72      {
73          this.time = time;
74      }
75  
76      public String buildCommand()
77      {
78          return "SET AUTOHANGUP " + time;
79      }
80  }