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   * A PeerEntryEvent is triggered in response to a SIPPeersAction or SIPShowPeerAction and contains
21   * information about a peer.<br>
22   * It is implemented in <code>channels/chan_sip.c</code>
23   * 
24   * @author srt
25   * @version $Id: PeerEntryEvent.java,v 1.1 2005/07/18 14:53:08 srt Exp $
26   * @since 0.2
27   */
28  public class PeerEntryEvent extends ResponseEvent
29  {
30      /***
31       * Serial version identifier
32       */
33      private static final long serialVersionUID = 1443711349135777437L;
34  
35      private String channelType;
36      private String objectName;
37      private String chanObjectType;
38      private String ipAddress;
39      private int ipPort;
40      private Boolean dynamic;
41      private Boolean natSupport;
42      private Boolean acl;
43      private String status;
44  
45      /***
46       * Creates a new instance.
47       * 
48       * @param source
49       */
50      public PeerEntryEvent(Object source)
51      {
52          super(source);
53      }
54  
55      /***
56       * For SIP peers this is "SIP".
57       * 
58       * @return
59       */
60      public String getChannelType()
61      {
62          return channelType;
63      }
64  
65      public void setChannelType(String channelType)
66      {
67          this.channelType = channelType;
68      }
69  
70      public String getObjectName()
71      {
72          return objectName;
73      }
74  
75      public void setObjectName(String objectName)
76      {
77          this.objectName = objectName;
78      }
79  
80      /***
81       * For SIP peers this is either "peer" or "user".
82       * 
83       * @return
84       */
85      public String getChanObjectType()
86      {
87          return chanObjectType;
88      }
89  
90      public void setChanObjectType(String chanObjectType)
91      {
92          this.chanObjectType = chanObjectType;
93      }
94  
95      /***
96       * Returns the IP address of the peer.
97       * 
98       * @return the IP address of the peer or "-none-" if none is available.
99       */
100     public String getIpAddress()
101     {
102         return ipAddress;
103     }
104 
105     /***
106      * Sets the IP address of the peer.
107      * 
108      * @param ipAddress the IP address of the peer.
109      */
110     public void setIpAddress(String ipAddress)
111     {
112         this.ipAddress = ipAddress;
113     }
114 
115     public int getIpPort()
116     {
117         return ipPort;
118     }
119 
120     public void setIpPort(int ipPort)
121     {
122         this.ipPort = ipPort;
123     }
124 
125     public Boolean getDynamic()
126     {
127         return dynamic;
128     }
129 
130     public void setDynamic(Boolean dynamic)
131     {
132         this.dynamic = dynamic;
133     }
134 
135     public Boolean getNatSupport()
136     {
137         return natSupport;
138     }
139 
140     public void setNatSupport(Boolean natSupport)
141     {
142         this.natSupport = natSupport;
143     }
144 
145     public Boolean getAcl()
146     {
147         return acl;
148     }
149 
150     public void setAcl(Boolean acl)
151     {
152         this.acl = acl;
153     }
154 
155     /***
156      * Returns the status of this peer.<br>
157      * For SIP peers this is one of:
158      * <dl>
159      * <dt>"UNREACHABLE"</dt>
160      * <dd></dd>
161      * <dt>"LAGGED (%d ms)"</dt>
162      * <dd></dd>
163      * <dt>"OK (%d ms)"</dt>
164      * <dd></dd>
165      * <dt>"UNKNOWN"</dt>
166      * <dd></dd>
167      * <dt>"Unmonitored"</dt>
168      * <dd></dd>
169      * </dl>
170      * 
171      * @return the status of this peer.
172      */
173     public String getStatus()
174     {
175         return status;
176     }
177 
178     /***
179      * Sets the status of this peer.
180      * 
181      * @param status the status of this peer.
182      */
183     public void setStatus(String status)
184     {
185         this.status = status;
186     }
187 }