Development

Development.EventNotification History

Hide minor edits - Show changes to markup

May 26, 2011, at 12:15 PM by razvancrainea -
Changed line 58 from:

Events unsubscription

to:

Event unsubscription

Changed line 62 from:

Events notification

to:

Event notification

Changed line 68 from:

Events implemented

to:

Implemented events

May 26, 2011, at 12:14 PM by razvancrainea -
Changed lines 30-31 from:

This function receives the event name, and optionally two AVPs. 'attrs' should contain a list of attributes name. 'vals' should contain the attributes values. Note that 'attrs' and 'vals' cardinality should be the same. An example of usage is:

to:

This function receives the event name, and optionally two AVPs. 'attrs' should contain a list of attributes name. 'vals' should contain the attributes values. Note that 'attrs' and 'vals' cardinality must be the same. An example of usage is:

Changed line 51 from:
0
to:
1800
Changed lines 54-66 from:

Event Notification Interface will be implemented in OpenSIPS core and will provide the following functionalities:

  • manage the events exported by the OpenSIPS modules
  • allow external application to subscribe for events
  • trigger a raised event event
  • build a notification message
  • notify all external applications subscribed for the triggered event

When loaded, each module will need to publish a list of exported events. They will also take care of raising each event in the appropriate moment (see Use cases section).

We will also need to implement (or update the existing ones) different modules for transport (and data encoding) protocol.

Use cases

to:

This command subscribes the external application for the event E_DUMMY. It also informs OpenSIPS Event Interface that it wants to be notified when events occur using UDP transfer protocol on localhost, port 8081, and the subscription will expire after 1800 seconds.

For more information about socket description and transport modules you can consult OpenSIPS documentation.

Events unsubscription

Changed lines 60-63 from:
  1. when pike module detects flood traffic, notify an external application that activates firewall
  2. when dispatcher module disables an entity, notify an application to send an email to the administrator

TODO

to:

You can unsubscribe for an event by simply send an MI command with the expiration field 0. Note that the socket must be the same with the initial subscription, otherwise it won't be matched.

Events notification

Changed lines 64-67 from:

Define:

  • subscription algorithm
  • data packing
  • transport protocol
to:

When an event is fired, OpenSIPS event notification will try to notify all the subscribers. For that it will search for the desired transport protocol, pack the data and send it to the destination specified in subscription.

This version contains only 'event_datagram' transport module that supports UNIX and UDP sockets.

Events implemented


  • E_CORE_THRESHOLD - raised when using debugging bottleneck detection and the limit is exceeded.
  • E_PIKE_BLOCKED - raised when 'pike' module decides an IP should be blocked.
  • E_RTPPROXY_STATUS - raised when a RTPProxy connects or disconnects.
  • E_DISPATCHER_STATUS - raised by the 'dispatcher' module when a destination address becomes active/inactive.

TODO


  • Provide devel documentation for transport protocols and modules events
  • Implement XMLRPC and SIP transport protocol
  • Add events to other modules (acc, usrloc, etc.)
May 25, 2011, at 05:45 PM by razvancrainea -
Added line 14:
Added lines 17-54:

2011/05/25 - Initial implementation This version implements the following functions:

Events handling


You can push different events from script, modules and even core. There are two types of events:

  • exported by modules and core - the information about these events will be available in the compilation phase. These events will be documented in the corresponding module that raises them.
  • script events - these events can be dynamically declared and raised from the script using the following function:

raise_event(event_name[, attrs] [, vals])

This function receives the event name, and optionally two AVPs. 'attrs' should contain a list of attributes name. 'vals' should contain the attributes values. Note that 'attrs' and 'vals' cardinality should be the same. An example of usage is:

$avp(s:attr) = "number";
$avp(s:val) = 0;
$avp(s:attr) = "string";
$avp(s:val) = "dummy value";

raise_event("E_DUMMY", $avp(s:attr), $avp(s:val));

Events subscription


In order to subscribe for an event you should send to OpenSIPS MI command the command event_subscribe with three parameters:

  • event name
  • event listener socket
  • subscription expiration in seconds (optional, the default is 3600s).

An example of FIFO subscribe command is:

:event_subscribe:/tmp/subscribe_reply_fifo
E_DUMMY
udp:127.0.0.1:8081
0
March 08, 2011, at 09:37 AM by razvancrainea -
Changed lines 8-9 from:

External applications can interact with OpenSIPS through the MI mechanism. If an application needs to take some actions based on a certain event, it needs to periodically query OpenSIPS and decide if that event occurred or not. As you figured out, this is not an optimal solution since the external application will spend a lot of time and load detecting if the event was raised or not, instead of executing the desired action.

to:

External applications can interact with OpenSIPS through the MI commands. This is a pull based mechanism, meaning when you need an information you have to interrogate the proxy. If an application needs to take some actions based on a certain event, it needs to periodically query OpenSIPS and decide if that event occurred or not. As you figured out, this is not an optimal solution since the external application will spend a lot of time and load detecting if the event was raised or not, instead of executing the desired action. That's why we needed a push based mechanism, so that OpenSIPS can notify an external application each time an event is raised.

Changed lines 23-26 from:

When loaded, each module will publish a list of events.

There will be different modules for each transport (and data encoding) protocol.

to:

When loaded, each module will need to publish a list of exported events. They will also take care of raising each event in the appropriate moment (see Use cases section).

We will also need to implement (or update the existing ones) different modules for transport (and data encoding) protocol.

Added line 33:

March 07, 2011, at 06:17 PM by razvancrainea -
Changed line 16 from:

Event Notification Interface will provide the following functionalities:

to:

Event Notification Interface will be implemented in OpenSIPS core and will provide the following functionalities:

Added lines 23-26:

When loaded, each module will publish a list of events.

There will be different modules for each transport (and data encoding) protocol.

Changed lines 30-36 from:
  1. when dispatcher module disables an entity, notify an application to send an email to the administrator
to:
  1. when dispatcher module disables an entity, notify an application to send an email to the administrator

TODO

Define:

  • subscription algorithm
  • data packing
  • transport protocol
March 07, 2011, at 05:53 PM by razvancrainea -
Changed lines 4-5 from:

A new feature will be added to OpenSIPS that will provide an event notification mechanism. This new module will supply an interface for external applications to be notified when certain events occur.

to:

OpenSIPS will be improved with an event notification mechanism. This new feature will provide an interface for external applications to be notified when certain events occur.

Changed lines 8-9 from:

External applications can interact with OpenSIPS through MI mechanism. If an application needs to take some actions based on a certain event, it needs to periodically query OpenSIPS and decide if that event occurred. As you figured out, this is not an optimal solution since the external application will spend a lot of time and load in detecting if the event occurred instead of executing the desired action.

to:

External applications can interact with OpenSIPS through the MI mechanism. If an application needs to take some actions based on a certain event, it needs to periodically query OpenSIPS and decide if that event occurred or not. As you figured out, this is not an optimal solution since the external application will spend a lot of time and load detecting if the event was raised or not, instead of executing the desired action.

Changed lines 12-13 from:

Each OpenSIPS module will export a number of events. Event Notification module will manage them, and will also provide an interface for the external applications to register for certain events. When an event raises, the module will notify all the applications that registered for that event. Once an external application receives a notification, it can execute the desired action.

to:

Each OpenSIPS module will export a number of events, managed by the event notification mechanism. External applications will be able to subscribe for these events through the event interface. When an event is raised by a module, OpenSIPS searches for all applications subscribed for it, and sends them a notification message. Once an external application receives a notification, it can execute the desired action.

Changed line 16 from:

Event Notification module will provide the following functionalities:

to:

Event Notification Interface will provide the following functionalities:

Changed lines 18-19 from:
  • allow external application to register or deregister for some events
  • trigger when an event raises
to:
  • allow external application to subscribe for events
  • trigger a raised event event
Changed line 21 from:
  • notify all external applications registered for the triggered event
to:
  • notify all external applications subscribed for the triggered event
March 07, 2011, at 01:40 PM by razvancrainea -
Added line 15:

Changed line 23 from:

Examples

to:

Use cases

March 07, 2011, at 01:40 PM by razvancrainea -
Changed lines 8-9 from:

External applications can interact with OpenSIPS through MI mechanism. If an application needs to take some actions based on a certain event, it needs to periodically query OpenSIPS and decide if that event occurred.

to:

External applications can interact with OpenSIPS through MI mechanism. If an application needs to take some actions based on a certain event, it needs to periodically query OpenSIPS and decide if that event occurred. As you figured out, this is not an optimal solution since the external application will spend a lot of time and load in detecting if the event occurred instead of executing the desired action.

Changed lines 12-13 from:

Event Notification Interface module will provide the following features:

  • allow OpenSIPS modules to register certain events for publishing
to:

Each OpenSIPS module will export a number of events. Event Notification module will manage them, and will also provide an interface for the external applications to register for certain events. When an event raises, the module will notify all the applications that registered for that event. Once an external application receives a notification, it can execute the desired action.

Implementation

Event Notification module will provide the following functionalities:

  • manage the events exported by the OpenSIPS modules
Changed lines 18-19 from:
  • trigger when an events occurs and build a notification message
to:
  • trigger when an event raises
  • build a notification message
March 07, 2011, at 01:31 PM by razvancrainea -
Added lines 1-21:

Development -> Sand Box -> Event Notification Interface


A new feature will be added to OpenSIPS that will provide an event notification mechanism. This new module will supply an interface for external applications to be notified when certain events occur.

Problem


External applications can interact with OpenSIPS through MI mechanism. If an application needs to take some actions based on a certain event, it needs to periodically query OpenSIPS and decide if that event occurred.

Solution


Event Notification Interface module will provide the following features:

  • allow OpenSIPS modules to register certain events for publishing
  • allow external application to register or deregister for some events
  • trigger when an events occurs and build a notification message
  • notify all external applications registered for the triggered event

Examples


  1. when pike module detects flood traffic, notify an external application that activates firewall
  2. when dispatcher module disables an entity, notify an application to send an email to the administrator

Page last modified on May 26, 2011, at 12:15 PM