SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Static Public Member Functions | Data Fields | Protected Member Functions
sipwitch::events Class Reference

Event message and supporting methods for plugins. More...

#include <events.h>

Collaboration diagram for sipwitch::events:
Collaboration graph
[legend]

Public Types

enum  type_t {
  NOTICE, WARNING, FAILURE, TERMINATE,
  STATE, REALM, CALL, DROP,
  ACTIVATE, RELEASE, WELCOME, SYNC,
  CONTACT, PUBLISH
}
 

Static Public Member Functions

static bool start (void)
 Start server event system by binding event session listener. More...
 
static void state (const char *newstate)
 Send state change to connected clients. More...
 
static void realm (const char *newrealm)
 Send realm change to connected clients. More...
 
static void connect (cdr *rec)
 Send call connection to clients from cdr start record. More...
 
static void drop (cdr *rec)
 Send call disconnected event to clients from cdr stop record. More...
 
static void activate (MappedRegistry *user)
 Send event for first instance of user registration. More...
 
static void release (MappedRegistry *user)
 Send event for last instance of user expired or de-registering. More...
 
static void notice (const char *reason)
 Send notice to user. More...
 
static void warning (const char *reason)
 Send warning to user. More...
 
static void failure (const char *reason)
 Send error to user. More...
 
static void reload (void)
 Refresh clients with any config events... More...
 
static void publish (const char *address)
 Update publish address... More...
 
static void terminate (const char *reason)
 Notify server termination. More...
 
static void sync (unsigned period=0l)
 Test connection and housekeeping notification. More...
 

Data Fields

type_t type
 Type of event message. More...
 
union {
   struct {
      time_t   started
 
      char   reason [16]
 
      char   network [MAX_NETWORK_SIZE *2]
 
      char   dialed [MAX_USERID_SIZE]
 
      char   caller [MAX_IDENT_SIZE]
 
      char   display [MAX_DISPLAY_SIZE]
 
   }   call
 
   struct {
      unsigned   extension
 
      char   id [MAX_USERID_SIZE]
 
   }   user
 
   struct {
      time_t   started
 
      char   version [16]
 
      char   state [32]
 
      char   realm [64]
 
   }   server
 
   char   contact [160]
 
   char   reason [160]
 
   unsigned   period
 
msg
 Content of message, based on type. More...
 

Protected Member Functions

bool put (events *event)
 Internal method to send an event message. More...
 

Detailed Description

Event message and supporting methods for plugins.

This defines what an event message is as passed from the server to clients listening on (unix or inet) sockets, and also what functions are offered in the runtime library for the server and plugins to send events to clients.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 66 of file events.h.

Member Enumeration Documentation

Enumerator
NOTICE 
WARNING 
FAILURE 
TERMINATE 
STATE 
REALM 
CALL 
DROP 
ACTIVATE 
RELEASE 
WELCOME 
SYNC 
CONTACT 
PUBLISH 

Definition at line 77 of file events.h.

Member Function Documentation

void sipwitch::events::activate ( MappedRegistry user)
static

Send event for first instance of user registration.

This is sent after the shared memory registry object is updated.

Parameters
userregistration record activated.

Definition at line 284 of file events.cpp.

void sipwitch::events::connect ( cdr rec)
static

Send call connection to clients from cdr start record.

Parameters
cdrrecord of started call.

Definition at line 260 of file events.cpp.

void sipwitch::events::drop ( cdr rec)
static

Send call disconnected event to clients from cdr stop record.

Parameters
cdrof disconnected call.

Definition at line 273 of file events.cpp.

void sipwitch::events::failure ( const char *  reason)
static

Send error to user.

These are sent from the runtime logging, so if plugins already log messages they do not have to separately call this.

Parameters
reasonfor error.

Definition at line 354 of file events.cpp.

void sipwitch::events::notice ( const char *  reason)
static

Send notice to user.

These are sent from the runtime logging, so if plugins already log messages they do not have to separately call this.

Parameters
reasonfor notice.

Definition at line 336 of file events.cpp.

void sipwitch::events::publish ( const char *  address)
static

Update publish address...

Parameters
publishedaddress.

Definition at line 380 of file events.cpp.

bool sipwitch::events::put ( events event)
protected

Internal method to send an event message.

Parameters
eventto send to connected clients.
Returns
true if sent successfully.
static void sipwitch::events::realm ( const char *  newrealm)
static

Send realm change to connected clients.

Parameters
newrealmserver changed to.
void sipwitch::events::release ( MappedRegistry user)
static

Send event for last instance of user expired or de-registering.

This is sent after the shared memory registry object is updated.

Parameters
userregistration record released.

Definition at line 294 of file events.cpp.

void sipwitch::events::reload ( void  )
static

Refresh clients with any config events...

Definition at line 363 of file events.cpp.

bool sipwitch::events::start ( void  )
static

Start server event system by binding event session listener.

Parameters
trueif sucessfully bound and started.

Definition at line 203 of file events.cpp.

static void sipwitch::events::state ( const char *  newstate)
static

Send state change to connected clients.

Parameters
newstateserver changed to.
void sipwitch::events::sync ( unsigned  period = 0l)
static

Test connection and housekeeping notification.

A sync with a period of 0 is used to test existing sessions to see if they are connected.

Parameters
periodof housekeeping event or 0 if connection test.

Definition at line 328 of file events.cpp.

void sipwitch::events::terminate ( const char *  reason)
static

Notify server termination.

Parameters
reasonserver terminated.

Definition at line 390 of file events.cpp.

void sipwitch::events::warning ( const char *  reason)
static

Send warning to user.

These are sent from the runtime logging, so if plugins already log messages they do not have to separately call this.

Parameters
reasonfor warning.

Definition at line 345 of file events.cpp.

Field Documentation

struct { ... } sipwitch::events::call
char sipwitch::events::caller[MAX_IDENT_SIZE]

Definition at line 93 of file events.h.

char sipwitch::events::contact[160]

Definition at line 106 of file events.h.

char sipwitch::events::dialed[MAX_USERID_SIZE]

Definition at line 92 of file events.h.

char sipwitch::events::display[MAX_DISPLAY_SIZE]

Definition at line 94 of file events.h.

unsigned sipwitch::events::extension

Definition at line 97 of file events.h.

char sipwitch::events::id[MAX_USERID_SIZE]

Definition at line 98 of file events.h.

union { ... } sipwitch::events::msg

Content of message, based on type.

char sipwitch::events::network[MAX_NETWORK_SIZE *2]

Definition at line 91 of file events.h.

unsigned sipwitch::events::period

Definition at line 108 of file events.h.

void sipwitch::events::realm

Definition at line 104 of file events.h.

char sipwitch::events::reason[160]

Definition at line 90 of file events.h.

struct { ... } sipwitch::events::server
time_t sipwitch::events::started

Definition at line 89 of file events.h.

void sipwitch::events::state

Definition at line 103 of file events.h.

type_t sipwitch::events::type

Type of event message.

Definition at line 82 of file events.h.

struct { ... } sipwitch::events::user
char sipwitch::events::version[16]

Definition at line 102 of file events.h.


The documentation for this class was generated from the following files: