Asterisk - The Open Source Telephony Project
18.5.0
|
Presence state management. More...
Go to the source code of this file.
Data Structures | |
struct | ast_presence_state_message |
Stasis message payload representing a presence state update. More... | |
Typedefs | |
typedef enum ast_presence_state(* | ast_presence_state_prov_cb_type) (const char *data, char **subtype, char **message) |
Presence state provider call back. More... | |
Functions | |
enum ast_presence_state | ast_presence_state (const char *presence_provider, char **subtype, char **message) |
Asks a presence state provider for the current presence state. More... | |
const char * | ast_presence_state2str (enum ast_presence_state state) |
Convert presence state to text string for output. More... | |
struct stasis_cache * | ast_presence_state_cache (void) |
Backend cache for ast_presence_state_topic_cached() More... | |
int | ast_presence_state_changed (enum ast_presence_state state, const char *subtype, const char *message, const char *fmt,...) |
Notify the world that a presence provider state changed. More... | |
int | ast_presence_state_changed_literal (enum ast_presence_state state, const char *subtype, const char *message, const char *presence_provider) |
Notify the world that a presence provider state changed. More... | |
int | ast_presence_state_engine_init (void) |
struct stasis_message_type * | ast_presence_state_message_type (void) |
Get presence state message type. More... | |
enum ast_presence_state | ast_presence_state_nocache (const char *presence_provider, char **subtype, char **message) |
Asks a presence state provider for the current presence state, bypassing the event cache. More... | |
int | ast_presence_state_prov_add (const char *label, ast_presence_state_prov_cb_type callback) |
Add presence state provider. More... | |
int | ast_presence_state_prov_del (const char *label) |
Remove presence state provider. More... | |
struct stasis_topic * | ast_presence_state_topic_all (void) |
Get presence state topic. More... | |
struct stasis_topic * | ast_presence_state_topic_cached (void) |
Get caching presence state topic. More... | |
enum ast_presence_state | ast_presence_state_val (const char *val) |
Convert presence state from text to integer value. More... | |
Presence state management.
Definition in file presencestate.h.
typedef enum ast_presence_state(* ast_presence_state_prov_cb_type) (const char *data, char **subtype, char **message) |
Presence state provider call back.
Definition at line 43 of file presencestate.h.
enum ast_presence_state |
Enumerator | |
---|---|
AST_PRESENCE_NOT_SET | |
AST_PRESENCE_UNAVAILABLE | |
AST_PRESENCE_AVAILABLE | |
AST_PRESENCE_AWAY | |
AST_PRESENCE_XA | |
AST_PRESENCE_CHAT | |
AST_PRESENCE_DND | |
AST_PRESENCE_INVALID |
Definition at line 26 of file presencestate.h.
enum ast_presence_state ast_presence_state | ( | const char * | presence_provider, |
char ** | subtype, | ||
char ** | message | ||
) |
Asks a presence state provider for the current presence state.
presence_provider | The presence provider to retrieve the state from. |
subtype | The output paramenter to store the subtype string in. Must be freed if returned |
message | The output paramenter to store the message string in. Must be freed if returned |
presence | state value on success, |
-1 | on failure. |
Definition at line 221 of file presencestate.c.
References ast_presence_state_helper().
const char* ast_presence_state2str | ( | enum ast_presence_state | state | ) |
Convert presence state to text string for output.
state | Current presence state |
Definition at line 103 of file presencestate.c.
References ARRAY_LEN, and state2string.
Referenced by action_presencestate(), AST_TEST_DEFINE(), exten_state_publisher_state_cb(), handle_cli_presencestate_list(), handle_show_hint(), handle_show_hints(), manager_state_cb(), pidf_supplement_body(), presence_change_common(), presence_read(), presence_state_to_ami(), and state_notify_build_xml().
struct stasis_cache* ast_presence_state_cache | ( | void | ) |
Backend cache for ast_presence_state_topic_cached()
Cache | of ast_presence_state_message. |
Definition at line 370 of file presencestate.c.
References presence_state_cache.
Referenced by action_presencestatelist(), and presence_state_cached().
int ast_presence_state_changed | ( | enum ast_presence_state | state, |
const char * | subtype, | ||
const char * | message, | ||
const char * | fmt, | ||
... | |||
) |
Notify the world that a presence provider state changed.
state | the new presence state |
subtype | the new presence subtype |
message | the new presence message |
fmt | Presence entity whose state has changed |
The new state of the entity will be sent off to any subscribers of the presence state. It will also be stored in the internal event cache.
0 | Success |
-1 | Failure |
Definition at line 350 of file presencestate.c.
References AST_MAX_EXTENSION, ast_presence_state_changed_literal(), and buf.
Referenced by load_module().
int ast_presence_state_changed_literal | ( | enum ast_presence_state | state, |
const char * | subtype, | ||
const char * | message, | ||
const char * | presence_provider | ||
) |
Notify the world that a presence provider state changed.
state | the new presence state |
subtype | the new presence subtype |
message | the new presence message |
presence_provider | Presence entity whose state has changed |
The new state of the entity will be sent off to any subscribers of the presence state. It will also be stored in the internal event cache.
0 | Success |
-1 | Failure |
Definition at line 336 of file presencestate.c.
References AST_PRESENCE_NOT_SET, do_presence_state_change(), and presence_state_event().
Referenced by ast_presence_state_changed(), handle_cli_presencestate_change(), and presence_write().
int ast_presence_state_engine_init | ( | void | ) |
Definition at line 495 of file presencestate.c.
References ast_presence_state_message_type(), ast_register_cleanup(), AST_TEST_REGISTER, presence_state_engine_cleanup(), presence_state_get_id(), stasis_cache_create(), stasis_caching_accept_message_type(), stasis_caching_set_filter(), stasis_caching_topic_create(), STASIS_MESSAGE_TYPE_INIT, STASIS_SUBSCRIPTION_FILTER_SELECTIVE, and stasis_topic_create().
Referenced by asterisk_daemon().
struct stasis_message_type* ast_presence_state_message_type | ( | void | ) |
Get presence state message type.
Stasis | message type for presence state messages |
Referenced by action_presencestatelist(), ast_presence_state_engine_init(), load_pbx(), presence_state_cached(), presence_state_cb(), presence_state_engine_cleanup(), presence_state_event(), presence_state_get_id(), and test_cb().
enum ast_presence_state ast_presence_state_nocache | ( | const char * | presence_provider, |
char ** | subtype, | ||
char ** | message | ||
) |
Asks a presence state provider for the current presence state, bypassing the event cache.
Some presence state providers may perform transformations on presence data when it is requested (such as a base64 decode). In such instances, use of the event cache is not suitable and should be bypassed.
presence_provider | The presence provider to retrieve the state from. |
subtype | The output paramenter to store the subtype string in. Must be freed if returned |
message | The output paramenter to store the message string in. Must be freed if returned |
presence | state value on success, |
-1 | on failure. |
Definition at line 226 of file presencestate.c.
References ast_presence_state_helper().
Referenced by AST_TEST_DEFINE(), and presence_read().
int ast_presence_state_prov_add | ( | const char * | label, |
ast_presence_state_prov_cb_type | callback | ||
) |
Add presence state provider.
label | to use in hint, like label:object |
callback | Callback |
0 | success |
-1 | failure |
Definition at line 231 of file presencestate.c.
References ast_calloc, ast_copy_string(), AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, presence_state_provider::callback, presence_state_provider::label, and provider.
Referenced by load_module().
int ast_presence_state_prov_del | ( | const char * | label | ) |
Remove presence state provider.
label | to use in hint, like label:object |
-1 | on failure |
0 | on success |
Definition at line 248 of file presencestate.c.
References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, presence_state_provider::label, and provider.
Referenced by unload_module().
struct stasis_topic* ast_presence_state_topic_all | ( | void | ) |
Get presence state topic.
Stasis | topic for presence state messages |
Definition at line 365 of file presencestate.c.
References presence_state_topic_all.
Referenced by load_module(), load_pbx(), presence_change_common(), presence_state_event(), and publish_hint_change().
struct stasis_topic* ast_presence_state_topic_cached | ( | void | ) |
Get caching presence state topic.
Caching | Stasis topic for presence state messages |
Definition at line 375 of file presencestate.c.
References stasis_caching_get_topic().
enum ast_presence_state ast_presence_state_val | ( | const char * | val | ) |
Convert presence state from text to integer value.
val | The text representing the presence state. Valid values are anything that comes after AST_PRESENCE_ in one of the defined values. |
Definition at line 114 of file presencestate.c.
References ARRAY_LEN, AST_PRESENCE_INVALID, and state2string.
Referenced by parse_data().