Asterisk - The Open Source Telephony Project GIT-master-7e7a603
Functions | Variables
manager_system.c File Reference

System AMI event handling. More...

#include "asterisk.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/stasis_system.h"
Include dependency graph for manager_system.c:

Go to the source code of this file.

Functions

int manager_system_init (void)
 Initialize support for AMI system events. More...
 
static void manager_system_shutdown (void)
 

Variables

static struct stasis_forwardtopic_forwarder
 The Stasis Message Bus API subscription returned by the forwarding of the system topic to the manager topic. More...
 

Detailed Description

System AMI event handling.

Author
Jason Parker jpark.nosp@m.er@d.nosp@m.igium.nosp@m..com

Definition in file manager_system.c.

Function Documentation

◆ manager_system_init()

int manager_system_init ( void  )

Initialize support for AMI system events.

Since
12
Return values
0on success
non-zeroon error

Definition at line 43 of file manager_system.c.

44{
47 struct stasis_message_router *message_router;
48
50 if (!manager_topic) {
51 return -1;
52 }
53 message_router = ast_manager_get_message_router();
54 if (!message_router) {
55 return -1;
56 }
58 if (!system_topic) {
59 return -1;
60 }
61
63 if (!topic_forwarder) {
64 return -1;
65 }
66
68
69 return 0;
70}
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Definition: clicompat.c:19
struct stasis_message_router * ast_manager_get_message_router(void)
Get the stasis_message_router for AMI.
Definition: manager.c:1877
struct stasis_topic * ast_manager_get_topic(void)
Get the Stasis Message Bus API topic for AMI.
Definition: manager.c:1872
static struct stasis_topic * manager_topic
A stasis_topic that all topics AMI cares about will be forwarded to.
Definition: manager.c:1636
static void manager_system_shutdown(void)
static struct stasis_forward * topic_forwarder
The Stasis Message Bus API subscription returned by the forwarding of the system topic to the manager...
struct stasis_forward * stasis_forward_all(struct stasis_topic *from_topic, struct stasis_topic *to_topic)
Create a subscription which forwards all messages from one topic to another.
Definition: stasis.c:1578
static struct stasis_topic * system_topic
The Stasis Message Bus API topic for system level changes.
Definition: stasis_system.c:68
struct stasis_topic * ast_system_topic(void)
A Stasis Message Bus API topic which publishes messages regarding system changes.

References ast_manager_get_message_router(), ast_manager_get_topic(), ast_register_cleanup(), ast_system_topic(), manager_system_shutdown(), manager_topic, stasis_forward_all(), system_topic, and topic_forwarder.

Referenced by subscribe_all().

◆ manager_system_shutdown()

static void manager_system_shutdown ( void  )
static

Definition at line 37 of file manager_system.c.

38{
41}
#define NULL
Definition: resample.c:96
struct stasis_forward * stasis_forward_cancel(struct stasis_forward *forward)
Definition: stasis.c:1548

References NULL, stasis_forward_cancel(), and topic_forwarder.

Referenced by manager_system_init().

Variable Documentation

◆ topic_forwarder

struct stasis_forward* topic_forwarder
static

The Stasis Message Bus API subscription returned by the forwarding of the system topic to the manager topic.

Definition at line 35 of file manager_system.c.

Referenced by manager_system_init(), and manager_system_shutdown().