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 AgentCallbackLoginAction sets an agent as logged in with callback.<br>
21   * You can pass an extentsion (and optionally a context) to specify the
22   * destination of the callback.<br>
23   * In contrast to the AgentCallbackLogin application that you can use within
24   * Asterisk's dialplan, you don't need to know the agent's password when logging
25   * in an agent.<br>
26   * Available since Asterisk 1.2
27   * 
28   * @author srt
29   * @version $Id: AgentCallbackLoginAction.java,v 1.4 2005/08/26 21:56:34 srt Exp $
30   * @since 0.2
31   */
32  public class AgentCallbackLoginAction extends AbstractManagerAction
33  {
34      /***
35       * Serializable version identifier
36       */
37      private static final long serialVersionUID = 5239805071977668779L;
38      private String agent;
39      private String exten;
40      private String context;
41      private Boolean ackCall;
42      private Long wrapupTime;
43  
44      /***
45       * Creates a new empty AgentCallbackLoginAction.
46       */
47      public AgentCallbackLoginAction()
48      {
49  
50      }
51  
52      /***
53       * Creates a new AgentCallbackLoginAction, that logs in the given agent at
54       * the given callback extension.
55       * 
56       * @param agent the name of the agent to log in
57       * @param exten the extension that is called to connect a queue member with
58       *            this agent
59       */
60      public AgentCallbackLoginAction(String agent, String exten)
61      {
62          this.agent = agent;
63          this.exten = exten;
64      }
65  
66      /***
67       * Creates a new AgentCallbackLoginAction, that logs in the given agent at
68       * the given callback extension in the given context.
69       * 
70       * @param agent the name of the agent to log in
71       * @param exten the extension that is called to connect a queue member with
72       *            this agent
73       * @param context the context of the extension to use for callback
74       */
75      public AgentCallbackLoginAction(String agent, String exten, String context)
76      {
77          this(agent, exten);
78          this.context = context;
79      }
80  
81      /***
82       * Returns the name of this action, i.e. "AgentCallbackLogin".
83       * 
84       * @return the name of this action
85       */
86      public String getAction()
87      {
88          return "AgentCallbackLogin";
89      }
90  
91      /***
92       * Returns the name of the agent to log in, for example "1002".
93       * 
94       * @return the name of the agent to log in
95       */
96      public String getAgent()
97      {
98          return agent;
99      }
100 
101     /***
102      * Sets the name of the agent to log in, for example "1002".<br>
103      * This is property is mandatory.
104      * 
105      * @param agent the name of the agent to log in
106      */
107     public void setAgent(String agent)
108     {
109         this.agent = agent;
110     }
111 
112     /***
113      * Returns the extension to use for callback.
114      * 
115      * @return the extension to use for callback.
116      */
117     public String getExten()
118     {
119         return exten;
120     }
121 
122     /***
123      * Sets the extension to use for callback.<br>
124      * This is property is mandatory.
125      * 
126      * @param exten the extension to use for callback.
127      */
128     public void setExten(String exten)
129     {
130         this.exten = exten;
131     }
132 
133     /***
134      * Returns the context of the extension to use for callback.
135      * 
136      * @return the context of the extension to use for callback.
137      */
138     public String getContext()
139     {
140         return context;
141     }
142 
143     /***
144      * Sets the context of the extension to use for callback.
145      * 
146      * @param context the context of the extension to use for callback.
147      */
148     public void setContext(String context)
149     {
150         this.context = context;
151     }
152 
153     /***
154      * Returns if an acknowledgement is needed when agent is called back.
155      * 
156      * @return Boolean.TRUE if acknowledgement by '#' is required when agent is
157      *         called back, Boolean.FALSE otherwise. <code>null</code> if
158      *         default should be used.
159      */
160     public Boolean getAckCall()
161     {
162         return ackCall;
163     }
164 
165     /***
166      * Sets if an acknowledgement is needed when agent is called back.<br>
167      * This property is optional, it allows you to override the defaults defined
168      * in Asterisk's configuration.
169      * 
170      * @param ackCall Boolean.TRUE to 'true' to require an acknowledgement by
171      *            '#' when agent is called back, Boolean.FALSE otherwise.
172      *            <code>null</code> if default should be used.
173      */
174     public void setAckCall(Boolean ackCall)
175     {
176         this.ackCall = ackCall;
177     }
178 
179     /***
180      * Returns the minimum amount of time after disconnecting before the caller
181      * can receive a new call.
182      * 
183      * @return the minimum amount of time after disconnecting before the caller
184      *         can receive a new call in milliseconds.
185      */
186     public Long getWrapupTime()
187     {
188         return wrapupTime;
189     }
190 
191     /***
192      * Sets the minimum amount of time after disconnecting before the caller can
193      * receive a new call.<br>
194      * This property is optional, it allows you to override the defaults defined
195      * in Asterisk's configuration.
196      * 
197      * @param wrapupTime the minimum amount of time after disconnecting before
198      *            the caller can receive a new call in milliseconds.
199      */
200     public void setWrapupTime(Long wrapupTime)
201     {
202         this.wrapupTime = wrapupTime;
203     }
204 }