Asterisk - The Open Source Telephony Project GIT-master-754dea3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Functions
stasis_system.h File Reference
#include "asterisk/stasis.h"
Include dependency graph for stasis_system.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct stasis_message_typeast_cc_available_type (void)
 A stasis_message_type for CCSS Available messages. More...
 
struct stasis_message_typeast_cc_callerrecalling_type (void)
 A stasis_message_type for CCSS Caller Recalling messages. More...
 
struct stasis_message_typeast_cc_callerstartmonitoring_type (void)
 A stasis_message_type for CCSS Caller Start Monitoring messages. More...
 
struct stasis_message_typeast_cc_callerstopmonitoring_type (void)
 A stasis_message_type for CCSS Caller Stop Monitoring messages. More...
 
struct stasis_message_typeast_cc_failure_type (void)
 A stasis_message_type for CCSS Failure messages. More...
 
struct stasis_message_typeast_cc_monitorfailed_type (void)
 A stasis_message_type for CCSS Monitor Failed messages. More...
 
struct stasis_message_typeast_cc_offertimerstart_type (void)
 A stasis_message_type for CCSS Offer Timer Start messages. More...
 
struct stasis_message_typeast_cc_recallcomplete_type (void)
 A stasis_message_type for CCSS Recall Complete messages. More...
 
struct stasis_message_typeast_cc_requestacknowledged_type (void)
 A stasis_message_type for CCSS Request Acknowledged messages. More...
 
struct stasis_message_typeast_cc_requested_type (void)
 A stasis_message_type for CCSS Requested messages. More...
 
struct stasis_message_typeast_cluster_discovery_type (void)
 A stasis_message_type for Cluster discovery. More...
 
struct stasis_message_typeast_network_change_type (void)
 A stasis_message_type for network changes. More...
 
int ast_stasis_system_init (void)
 Initialize the stasis system topic and message types. More...
 
void ast_system_publish_registry (const char *channeltype, const char *username, const char *domain, const char *status, const char *cause)
 Publish a channel driver outgoing registration message. More...
 
struct stasis_message_typeast_system_registry_type (void)
 A stasis_message_type for outbound registration. More...
 
struct stasis_topicast_system_topic (void)
 A Stasis Message Bus API topic which publishes messages regarding system changes. More...
 

Function Documentation

◆ ast_cc_available_type()

struct stasis_message_type * ast_cc_available_type ( void  )

A stasis_message_type for CCSS Available messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_available(), and stasis_system_cleanup().

◆ ast_cc_callerrecalling_type()

struct stasis_message_type * ast_cc_callerrecalling_type ( void  )

A stasis_message_type for CCSS Caller Recalling messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_callerrecalling(), and stasis_system_cleanup().

◆ ast_cc_callerstartmonitoring_type()

struct stasis_message_type * ast_cc_callerstartmonitoring_type ( void  )

A stasis_message_type for CCSS Caller Start Monitoring messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_callerstartmonitoring(), and stasis_system_cleanup().

◆ ast_cc_callerstopmonitoring_type()

struct stasis_message_type * ast_cc_callerstopmonitoring_type ( void  )

A stasis_message_type for CCSS Caller Stop Monitoring messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_callerstopmonitoring(), and stasis_system_cleanup().

◆ ast_cc_failure_type()

struct stasis_message_type * ast_cc_failure_type ( void  )

A stasis_message_type for CCSS Failure messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_failure(), and stasis_system_cleanup().

◆ ast_cc_monitorfailed_type()

struct stasis_message_type * ast_cc_monitorfailed_type ( void  )

A stasis_message_type for CCSS Monitor Failed messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_monitorfailed(), and stasis_system_cleanup().

◆ ast_cc_offertimerstart_type()

struct stasis_message_type * ast_cc_offertimerstart_type ( void  )

A stasis_message_type for CCSS Offer Timer Start messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_offertimerstart(), and stasis_system_cleanup().

◆ ast_cc_recallcomplete_type()

struct stasis_message_type * ast_cc_recallcomplete_type ( void  )

A stasis_message_type for CCSS Recall Complete messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_recallcomplete(), and stasis_system_cleanup().

◆ ast_cc_requestacknowledged_type()

struct stasis_message_type * ast_cc_requestacknowledged_type ( void  )

A stasis_message_type for CCSS Request Acknowledged messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_requestacknowledged(), and stasis_system_cleanup().

◆ ast_cc_requested_type()

struct stasis_message_type * ast_cc_requested_type ( void  )

A stasis_message_type for CCSS Requested messages.

Since
12

Referenced by ast_stasis_system_init(), cc_publish_requested(), and stasis_system_cleanup().

◆ ast_cluster_discovery_type()

struct stasis_message_type * ast_cluster_discovery_type ( void  )

◆ ast_network_change_type()

struct stasis_message_type * ast_network_change_type ( void  )

A stasis_message_type for network changes.

Since
12
Return values
NULLon error
Returns
stasis_message_type for network changes
Note
Messages of this type should always be issued on and expected from the ast_system_topic Stasis Message Bus API topic

Referenced by ast_stasis_system_init(), load_module(), network_change_stasis_cb(), network_change_stasis_subscribe(), stasis_system_cleanup(), and stun_monitor_request().

◆ ast_stasis_system_init()

int ast_stasis_system_init ( void  )

Initialize the stasis system topic and message types.

Return values
0on success
-1on failure

Initialize the stasis system topic and message types.

Definition at line 376 of file stasis_system.c.

377{
379
380 system_topic = stasis_topic_create("system:all");
381 if (!system_topic) {
382 return 1;
383 }
384
386 return -1;
387 }
388
390 return -1;
391 }
392
394 return -1;
395 }
396
398 return -1;
399 }
400
402 return -1;
403 }
404
406 return -1;
407 }
408
410 return -1;
411 }
412
414 return -1;
415 }
416
418 return -1;
419 }
420
422 return -1;
423 }
424
426 return -1;
427 }
428
430 return -1;
431 }
432
434 return -1;
435 }
436
437 return 0;
438}
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Definition: clicompat.c:19
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
Definition: stasis.c:644
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
Definition: stasis.h:1493
static struct stasis_topic * system_topic
The Stasis Message Bus API topic for system level changes.
Definition: stasis_system.c:71
static void stasis_system_cleanup(void)
Cleanup the Stasis Message Bus API system level items.
struct stasis_message_type * ast_cc_monitorfailed_type(void)
A stasis_message_type for CCSS Monitor Failed messages.
struct stasis_message_type * ast_cc_recallcomplete_type(void)
A stasis_message_type for CCSS Recall Complete messages.
struct stasis_message_type * ast_system_registry_type(void)
A stasis_message_type for outbound registration.
struct stasis_message_type * ast_cc_callerrecalling_type(void)
A stasis_message_type for CCSS Caller Recalling messages.
struct stasis_message_type * ast_cluster_discovery_type(void)
A stasis_message_type for Cluster discovery.
struct stasis_message_type * ast_cc_failure_type(void)
A stasis_message_type for CCSS Failure messages.
struct stasis_message_type * ast_cc_callerstopmonitoring_type(void)
A stasis_message_type for CCSS Caller Stop Monitoring messages.
struct stasis_message_type * ast_cc_available_type(void)
A stasis_message_type for CCSS Available messages.
struct stasis_message_type * ast_cc_requestacknowledged_type(void)
A stasis_message_type for CCSS Request Acknowledged messages.
struct stasis_message_type * ast_network_change_type(void)
A stasis_message_type for network changes.
struct stasis_message_type * ast_cc_callerstartmonitoring_type(void)
A stasis_message_type for CCSS Caller Start Monitoring messages.
struct stasis_message_type * ast_cc_offertimerstart_type(void)
A stasis_message_type for CCSS Offer Timer Start messages.
struct stasis_message_type * ast_cc_requested_type(void)
A stasis_message_type for CCSS Requested messages.

References ast_cc_available_type(), ast_cc_callerrecalling_type(), ast_cc_callerstartmonitoring_type(), ast_cc_callerstopmonitoring_type(), ast_cc_failure_type(), ast_cc_monitorfailed_type(), ast_cc_offertimerstart_type(), ast_cc_recallcomplete_type(), ast_cc_requestacknowledged_type(), ast_cc_requested_type(), ast_cluster_discovery_type(), ast_network_change_type(), ast_register_cleanup(), ast_system_registry_type(), STASIS_MESSAGE_TYPE_INIT, stasis_system_cleanup(), stasis_topic_create(), and system_topic.

Referenced by asterisk_daemon().

◆ ast_system_publish_registry()

void ast_system_publish_registry ( const char *  channeltype,
const char *  username,
const char *  domain,
const char *  status,
const char *  cause 
)

Publish a channel driver outgoing registration message.

Since
12
Parameters
channeltypeThe channel driver that published the message
usernameThe username that was used to register
domainThe domain that was used to register
statusThe result of the registration
causeThe reason for the result

Definition at line 121 of file stasis_system.c.

122{
123 struct ast_json *registry;
124 struct ast_json_payload *payload;
125 struct stasis_message *message;
126
128 return;
129 }
130
131 registry = ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: s}",
132 "type", "registry",
133 "channeltype", channeltype,
134 "username", username,
135 "domain", domain,
136 "status", status,
137 "cause", S_OR(cause, ""));
138
139 payload = ast_json_payload_create(registry);
140 ast_json_unref(registry);
141 if (!payload) {
142 return;
143 }
144
146 ao2_ref(payload, -1);
147 if (!message) {
148 return;
149 }
150
152 ao2_ref(message, -1);
153}
jack_status_t status
Definition: app_jack.c:149
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
Definition: json.c:73
struct ast_json_payload * ast_json_payload_create(struct ast_json *json)
Create an ao2 object to pass json blobs as data payloads for stasis.
Definition: json.c:756
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
Definition: json.c:612
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
Definition: stasis.c:1538
struct stasis_topic * ast_system_topic(void)
A Stasis Message Bus API topic which publishes messages regarding system changes.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
Definition: strings.h:80
Abstract JSON element (object, array, string, int, ...).

References ao2_ref, ast_json_pack(), ast_json_payload_create(), ast_json_unref(), ast_system_registry_type(), ast_system_topic(), S_OR, stasis_message_create(), stasis_publish(), and status.

Referenced by handle_registration_response(), and iax2_publish_registry().

◆ ast_system_registry_type()

struct stasis_message_type * ast_system_registry_type ( void  )

◆ ast_system_topic()

struct stasis_topic * ast_system_topic ( void  )

A Stasis Message Bus API topic which publishes messages regarding system changes.

Since
12
Returns
stasis_topic for system level changes
Return values
NULLon error

Definition at line 350 of file stasis_system.c.

351{
352 return system_topic;
353}

References system_topic.

Referenced by ast_system_publish_registry(), cc_publish(), load_module(), manager_system_init(), network_change_stasis_subscribe(), pjsip_outbound_registration_metrics_init(), publish_cluster_discovery_to_stasis_full(), publish_format_update(), and stun_monitor_request().