net.sf.asterisk.manager.event
Class UserEvent
java.lang.Object
java.util.EventObject
net.sf.asterisk.manager.event.ManagerEvent
net.sf.asterisk.manager.event.UserEvent
- All Implemented Interfaces:
- java.io.Serializable
public abstract class UserEvent
- extends ManagerEvent
Abstract base class for user events.
You can send arbitrary user events via the UserEvent application provided with asterisk. A user
event by default has the attributes channel and uniqueId but you can add custom attributes by
specifying an event body.
To add your own user events you must subclass this class and name it corresponding to your event.
If you plan to send an event by UserEvent(VIPCall)
you will create a new class
called VIPCallEvent that extends UserEvent. The name of this class is important: Just use the
name of the event you will send (VIPCall in this example) and append "Event".
To pass additional data create appropriate attributes with getter and setter methods in your
new class.
Example:
public class VIPCallEvent extends UserEvent
{
private String firstName;
public VIPCallEvent(Object source)
{
super(source);
}
public String getFirstName()
{
return firstName;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
}
To send this event use UserEvent(VIPCall|firstName: Jon)
in your dialplan.
The UserEvent is implemented in apps/app_userevent.c
.
Note that you must register your UserEvent with the ManagerConnection you are using in order
to be recognized.
- Version:
- $Id: UserEvent.java,v 1.2 2005/03/15 16:29:02 srt Exp $
- Author:
- srt
- See Also:
ManagerConnection.registerUserEventClass(Class)
,
Serialized Form
Fields inherited from class java.util.EventObject |
source |
Constructor Summary |
UserEvent(java.lang.Object source)
|
Method Summary |
java.lang.String |
getChannel()
Returns the name of the channel this event occured in. |
java.lang.String |
getUniqueId()
Returns the unqiue id of the channel this event occured in. |
void |
setChannel(java.lang.String channel)
Sets the name of the channel this event occured in. |
void |
setUniqueId(java.lang.String uniqueId)
Sets the unqiue id of the channel this event occured in. |
Methods inherited from class java.util.EventObject |
getSource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
UserEvent
public UserEvent(java.lang.Object source)
getChannel
public java.lang.String getChannel()
- Returns the name of the channel this event occured in.
- Returns:
- the name of the channel this event occured in.
setChannel
public void setChannel(java.lang.String channel)
- Sets the name of the channel this event occured in.
- Parameters:
channel
- the name of the channel this event occured in.
getUniqueId
public java.lang.String getUniqueId()
- Returns the unqiue id of the channel this event occured in.
- Returns:
- the unqiue id of the channel this event occured in.
setUniqueId
public void setUniqueId(java.lang.String uniqueId)
- Sets the unqiue id of the channel this event occured in.
- Parameters:
uniqueId
- the unqiue id of the channel this event occured in.
Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.