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.manager.action;
18  
19  /***
20   * The AbsoluteTimeoutAction sets the absolute maximum amount of time permitted
21   * for a call on a given channel.<br>
22   * Note that the timeout is set from the current time forward, not counting the
23   * number of seconds the call has already been up.<br>
24   * When setting a new timeout all previous absolute timeouts are cancelled.<br>
25   * When the timeout is reached the call is returned to the T extension so that
26   * you can playback an explanatory note to the calling party (the called party
27   * will not hear that).<br>
28   * This action corresponds the the AbsoluteTimeout command used in the dialplan.
29   * 
30   * @author srt
31   * @version $Id: AbsoluteTimeoutAction.java,v 1.4 2005/08/07 00:09:42 srt Exp $
32   */
33  public class AbsoluteTimeoutAction extends AbstractManagerAction
34  {
35      /***
36       * Serializable version identifier
37       */
38      static final long serialVersionUID = 3073237188819825503L;
39  
40      private String channel;
41      private Integer timeout;
42  
43      /***
44       * Creates a new empty AbsoluteTimeoutAction.
45       */
46      public AbsoluteTimeoutAction()
47      {
48  
49      }
50  
51      /***
52       * Creates a new AbsoluteTimeoutAction with the given channel and timeout.
53       * 
54       * @param channel the name of the channel
55       * @param timeout the timeout in seconds or 0 to cancel the AbsoluteTimeout
56       * @since 0.2
57       */
58      public AbsoluteTimeoutAction(String channel, Integer timeout)
59      {
60          this.channel = channel;
61          this.timeout = timeout;
62      }
63  
64      /***
65       * Returns the name of this action, i.e. "AbsoluteTimeout".
66       */
67      public String getAction()
68      {
69          return "AbsoluteTimeout";
70      }
71  
72      /***
73       * Returns the name of the channel.
74       */
75      public String getChannel()
76      {
77          return channel;
78      }
79  
80      /***
81       * Sets the name of the channel.
82       */
83      public void setChannel(String channel)
84      {
85          this.channel = channel;
86      }
87  
88      /***
89       * Returns the timeout (in seconds) to set.
90       */
91      public Integer getTimeout()
92      {
93          return timeout;
94      }
95  
96      /***
97       * Sets the timeout (in seconds) to set on channel.<br>
98       * Setting the timeout to 0 cancels the timeout.
99       */
100     public void setTimeout(Integer timeout)
101     {
102         this.timeout = timeout;
103     }
104 }