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   * Redirects a given channel (and an optional additional channel) to a new
21   * extension.
22   * 
23   * @author srt
24   * @version $Id: RedirectAction.java,v 1.4 2005/08/07 16:43:29 srt Exp $
25   */
26  public class RedirectAction extends AbstractManagerAction
27  {
28      /***
29       * Serializable version identifier
30       */
31      static final long serialVersionUID = 1869279324159418150L;
32  
33      private String channel;
34      private String extraChannel;
35      private String exten;
36      private String context;
37      private Integer priority;
38  
39      /***
40       * Creates a new empty RedirectAction.
41       */
42      public RedirectAction()
43      {
44  
45      }
46  
47      /***
48       * Creates a new RedirectAction that redirects the given channel to the
49       * given context, extension, priority triple.
50       * 
51       * @param channel the name of the channel to redirect
52       * @param context the destination context
53       * @param exten the destination extension
54       * @param priority the destination priority
55       * @since 0.2
56       */
57      public RedirectAction(String channel, String context, String exten,
58              Integer priority)
59      {
60          this.channel = channel;
61          this.context = context;
62          this.exten = exten;
63          this.priority = priority;
64      }
65  
66      /***
67       * Creates a new RedirectAction that redirects the given channels to the
68       * given context, extension, priority triple.
69       * 
70       * @param channel the name of the first channel to redirect
71       * @param extraChannel the name of the second channel to redirect
72       * @param context the destination context
73       * @param exten the destination extension
74       * @param priority the destination priority
75       * @since 0.2
76       */
77      public RedirectAction(String channel, String extraChannel, String context,
78              String exten, Integer priority)
79      {
80          this.channel = channel;
81          this.extraChannel = extraChannel;
82          this.context = context;
83          this.exten = exten;
84          this.priority = priority;
85      }
86  
87      /***
88       * Returns the name of this action, i.e. "Redirect".
89       */
90      public String getAction()
91      {
92          return "Redirect";
93      }
94  
95      /***
96       * Returns name of the channel to redirect.
97       * 
98       * @return the name of the channel to redirect
99       */
100     public String getChannel()
101     {
102         return channel;
103     }
104 
105     /***
106      * Sets the name of the channel to redirect.
107      * 
108      * @param channel the name of the channel to redirect
109      */
110     public void setChannel(String channel)
111     {
112         this.channel = channel;
113     }
114 
115     /***
116      * Returns the name of the additional channel to redirect.
117      * 
118      * @return the name of the additional channel to redirect
119      */
120     public String getExtraChannel()
121     {
122         return extraChannel;
123     }
124 
125     /***
126      * Sets the name of the additional channel to redirect.
127      * 
128      * @param extraChannel the name of the additional channel to redirect
129      */
130     public void setExtraChannel(String extraChannel)
131     {
132         this.extraChannel = extraChannel;
133     }
134 
135     /***
136      * Returns the destination context.
137      * 
138      * @return the destination context
139      */
140     public String getContext()
141     {
142         return context;
143     }
144 
145     /***
146      * Sets the destination context.
147      * 
148      * @param context the destination context
149      */
150     public void setContext(String context)
151     {
152         this.context = context;
153     }
154 
155     /***
156      * Returns the destination extension.
157      * 
158      * @return the destination extension
159      */
160     public String getExten()
161     {
162         return exten;
163     }
164 
165     /***
166      * Sets the destination extension.
167      * 
168      * @param exten the destination extension
169      */
170     public void setExten(String exten)
171     {
172         this.exten = exten;
173     }
174 
175     /***
176      * Returns the destination priority.
177      * 
178      * @return the destination priority
179      */
180     public Integer getPriority()
181     {
182         return priority;
183     }
184 
185     /***
186      * Sets the destination priority.
187      * 
188      * @param priority the destination priority
189      */
190     public void setPriority(Integer priority)
191     {
192         this.priority = priority;
193     }
194 }