Asterisk - The Open Source Telephony Project GIT-master-2de1a68
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 373 of file stasis_system.c.

374{
376
377 system_topic = stasis_topic_create("system:all");
378 if (!system_topic) {
379 return 1;
380 }
381
383 return -1;
384 }
385
387 return -1;
388 }
389
391 return -1;
392 }
393
395 return -1;
396 }
397
399 return -1;
400 }
401
403 return -1;
404 }
405
407 return -1;
408 }
409
411 return -1;
412 }
413
415 return -1;
416 }
417
419 return -1;
420 }
421
423 return -1;
424 }
425
427 return -1;
428 }
429
431 return -1;
432 }
433
434 return 0;
435}
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:617
#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:68
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 118 of file stasis_system.c.

119{
120 struct ast_json *registry;
121 struct ast_json_payload *payload;
122 struct stasis_message *message;
123
125 return;
126 }
127
128 registry = ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: s}",
129 "type", "registry",
130 "channeltype", channeltype,
131 "username", username,
132 "domain", domain,
133 "status", status,
134 "cause", S_OR(cause, ""));
135
136 payload = ast_json_payload_create(registry);
137 ast_json_unref(registry);
138 if (!payload) {
139 return;
140 }
141
143 ao2_ref(payload, -1);
144 if (!message) {
145 return;
146 }
147
149 ao2_ref(message, -1);
150}
jack_status_t status
Definition: app_jack.c:146
#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:1511
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 347 of file stasis_system.c.

348{
349 return system_topic;
350}

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().