1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.asterisk.manager.event;
18
19 /***
20 * A RegistryEvent is triggered when this asterisk server attempts to register
21 * as a client at another SIP or IAX server.<br>
22 * This event is implemented in <code>channels/chan_iax2.c</code> and
23 * <code>channels/chan_sip.c</code>
24 *
25 * @author srt
26 * @version $Id: RegistryEvent.java,v 1.7 2005/08/28 10:37:55 srt Exp $
27 */
28 public class RegistryEvent extends ManagerEvent
29 {
30 /***
31 * Serializable version identifier
32 */
33 private static final long serialVersionUID = 6243135032555863775L;
34 private String channel;
35 private String domain;
36 private String username;
37 private String status;
38 private String cause;
39
40 /***
41 * @param source
42 */
43 public RegistryEvent(Object source)
44 {
45 super(source);
46 }
47
48 /***
49 * Returns the type of channel that is registered, i.e. "IAX2" for an IAX2
50 * channel or "SIP" for a SIP channel.
51 */
52 public String getChannel()
53 {
54 return channel;
55 }
56
57 /***
58 * Sets the type of channel that is registered.
59 */
60 public void setChannel(String channel)
61 {
62 this.channel = channel;
63 }
64
65 /***
66 * Returns the domain or host name of the SIP or IAX2 server.<br>
67 * This is the host part used in the <code>register</code> lines in
68 * <code>iax.conf</code> and <code>sip.conf</code>.
69 */
70 public String getDomain()
71 {
72 return domain;
73 }
74
75 /***
76 * Sets the domain or host name of the SIP or IAX2 server.
77 */
78 public void setDomain(String domain)
79 {
80 this.domain = domain;
81 }
82
83 /***
84 * Returns the username used for registration.<br>
85 * SIP send the username in case of a registration timeout, IAX2 in case of
86 * a registration failure. Otherwise the username is <code>null</code>.
87 */
88 public String getUsername()
89 {
90 return username;
91 }
92
93 /***
94 * Sets the username used for registration.
95 */
96 public void setUsername(String username)
97 {
98 this.username = username;
99 }
100
101 /***
102 * Sets the username used for registration.
103 *
104 * @deprecated Please do not use this method it is a workaround for Asterisk
105 * 1.0.x servers. See Asterisk bug 4916.
106 */
107 public void setUser(String username)
108 {
109 this.username = username;
110 }
111
112 /***
113 * Returns the registration state.<br>
114 * For sip this may be one of (not sure if all of these are exposed via the
115 * manager api, at least "Registered" and "Timeout" are used though)
116 * <ul>
117 * <li>Registered</li>
118 * <li>Unregistered</li>
119 * <li>Request Sent</li>
120 * <li>Auth. Sent</li>
121 * <li>Rejected</li>
122 * <li>Timeout</li>
123 * <li>No Authentication</li>
124 * <li>Unreachable</li>
125 * </ul>
126 * IAX2 only uses
127 * <ul>
128 * <li>Rejected</li>
129 * </ul>
130 * Successful IAX2 registrations do not use the this property at all.
131 */
132 public String getStatus()
133 {
134 return status;
135 }
136
137 /***
138 * Sets the registration state.
139 */
140 public void setStatus(String status)
141 {
142 this.status = status;
143 }
144
145 /***
146 * Returns the cause of a rejected registration.
147 *
148 * @return the cause of a rejected registration or "<unknown>" if the
149 * cause is unknown.
150 * @since 0.2
151 */
152 public String getCause()
153 {
154 return cause;
155 }
156
157 /***
158 * Sets the cause of a rejected registration.
159 *
160 * @param cause the cause of a rejected registration.
161 * @since 0.2
162 */
163 public void setCause(String cause)
164 {
165 this.cause = cause;
166 }
167
168 }