AsterNet Class Library (Sandcastle documentation)
AsterNet Class Library (Sandcastle documentation)
AsterNET.Manager.Event
UserEvent Class
UserEvent Constructor
UserEvent Methods
UserEvent Properties

| UserEvent Class

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 : UserEvent
                {
                	 private string firstName;
                	 // Constructor
                	 public VIPCallEvent()
                	 {
                	 }
                	 // Property
                	 public string FirstName
                	 {
                		 get { return this.firstName; }
                		 set { this.firstName = value; }
                	 }
                 }

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.
Inheritance Hierarchy
System
Object
System
EventArgs
AsterNET.Manager.Event
ManagerEvent
AsterNET.Manager.Event
UserEvent

Namespace: AsterNET.Manager.Event
Assembly: AsterNET (in AsterNET.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
VB
C++
F#
Copy

    public class UserEvent : ManagerEvent

    Public Class UserEvent
    	Inherits ManagerEvent

    public ref class UserEvent : public ManagerEvent

    type UserEvent =
        class
            inherit ManagerEvent
        end

The UserEvent type exposes the following members.

Constructors

| Name | Description
--- | --- | ---
| UserEvent | Initializes a new instance of the UserEvent class

Top
Methods

| Name | Description
--- | --- | ---
| Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.)
| GetType | Gets the Type of the current instance. (Inherited from Object.)
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.)
| Parse | (Overrides ManagerEvent Parse(String, String).)
| ParseSpecial | Unknown properties parser. (Inherited from ManagerEvent.)
| ToString | Convert all properties to string (Inherited from ManagerEvent.)

Top
Properties

| Name | Description
--- | --- | ---
| Attributes | Store all unknown (without setter) keys from manager event. Use in default Parse method Parse(String, String) (Inherited from ManagerEvent.)
| Channel | Get/Set the name of the channel. (Inherited from ManagerEvent.)
| DateReceived | Get/Set the point in time this event was received from the Asterisk server. Pseudo events that are not directly received from the asterisk server (for example ConnectEvent and DisconnectEvent) may return null. (Inherited from ManagerEvent.)
| Privilege | Get/Set the AMI authorization class of this event. This is one or more of system, call, log, verbose, command, agent or user. Multiple privileges are separated by comma. Note: This property is not available from Asterisk 1.0 servers. (Inherited from ManagerEvent.)
| Server | Specify a server to which to send your commands (x.x.x.x or hostname). This should match the server name specified in your config file's "host" entry. If you do not specify a server, the proxy will pick the first one it finds -- fine in single-server configurations. (Inherited from ManagerEvent.)
| Source | The ManagerConnection the Event was sourced from. (Inherited from ManagerEvent.)
| Timestamp | Returns the timestamp for this event. The timestamp property is available in Asterisk since 1.4 if enabled in manager.conf by setting timestampevents = yes. In contains the time the event was generated in seconds since the epoch. (Inherited from ManagerEvent.)
| UniqueId | Get/Set the unique id of the channel. (Inherited from ManagerEvent.)
| UserEventName |

Top
See Also

#### Reference

AsterNET.Manager.Event Namespace
ManagerConnection
RegisterUserEventClass(Type)