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.event;
18  
19  /***
20   * Abstract base class providing common properties for HangupEvent, NewChannelEvent and
21   * NewStateEvent.
22   * 
23   * @author srt
24   * @version $Id: ChannelEvent.java,v 1.4 2005/02/26 20:50:31 srt Exp $
25   */
26  public abstract class ChannelEvent extends ManagerEvent
27  {
28      /***
29       * Serializable version identifier
30       */
31      static final long serialVersionUID = 5906599407896179295L;
32  
33      /***
34       * The name of the channel.
35       */
36      private String channel;
37  
38      /***
39       * The state of the channel.
40       */
41      private String state;
42  
43      /***
44       * This Caller*ID of the channel.
45       */
46      private String callerId;
47  
48      /***
49       * The Caller*ID Name of the channel.
50       */
51      private String callerIdName;
52  
53      /***
54       * The unique id of the channel.
55       */
56      private String uniqueId;
57  
58      /***
59       * @param source
60       */
61      public ChannelEvent(Object source)
62      {
63          super(source);
64      }
65  
66      /***
67       * Returns the name of the channel.
68       */
69      public String getChannel()
70      {
71          return channel;
72      }
73  
74      /***
75       * Sets the name of the channel.
76       */
77      public void setChannel(String channel)
78      {
79          this.channel = channel;
80      }
81  
82      /***
83       * Returns the unique id of the channel.
84       */
85      public String getUniqueId()
86      {
87          return uniqueId;
88      }
89  
90      /***
91       * Sets the unique id of the channel.
92       */
93      public void setUniqueId(String uniqueId)
94      {
95          this.uniqueId = uniqueId;
96      }
97  
98      /***
99       * Returns the Caller*ID of the channel if set or "≶unknown>" if none has been set.
100      */
101     public String getCallerId()
102     {
103         return callerId;
104     }
105 
106     /***
107      * Sets the Caller*ID of the channel.
108      * 
109      * @param callerId the Caller*ID of the channel.
110      */
111     public void setCallerId(String callerId)
112     {
113         this.callerId = callerId;
114     }
115 
116     /***
117      * Returns the Caller*ID Name of the channel if set or "≶unknown>" if none has been set.
118      * 
119      * @return the Caller*ID Name of the channel.
120      */
121     public String getCallerIdName()
122     {
123         return callerIdName;
124     }
125 
126     /***
127      * Sets the Caller*ID Name of the channel.
128      * 
129      * @param callerIdName the Caller*ID Name of the channel.
130      */
131     public void setCallerIdName(String callerIdName)
132     {
133         this.callerIdName = callerIdName;
134     }
135 
136     /***
137      * Returns the (new) state of the channel.<br>
138      * The following states are used:<br>
139      * <ul>
140      * <li>Down</li>
141      * <li>OffHook</li>
142      * <li>Dialing</li>
143      * <li>Ring</li>
144      * <li>Ringing</li>
145      * <li>Up</li>
146      * <li>Busy</li>
147      * <ul>
148      */
149     public String getState()
150     {
151         return state;
152     }
153 
154     /***
155      * Sets the (new) state of the channel.
156      */
157     public void setState(String state)
158     {
159         this.state = state;
160     }
161 }