| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
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. | |
| Enumerations | |
| enum | ast_presence_state { AST_PRESENCE_NOT_SET = 0 , AST_PRESENCE_UNAVAILABLE , AST_PRESENCE_AVAILABLE , AST_PRESENCE_AWAY , AST_PRESENCE_XA , AST_PRESENCE_CHAT , AST_PRESENCE_DND , AST_PRESENCE_INVALID } | 
| 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. | |
| const char * | ast_presence_state2str (enum ast_presence_state state) | 
| Convert presence state to text string for output. | |
| struct stasis_cache * | ast_presence_state_cache (void) | 
| Backend cache for ast_presence_state_topic_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. | |
| 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. | |
| int | ast_presence_state_engine_init (void) | 
| struct stasis_message_type * | ast_presence_state_message_type (void) | 
| Get presence state message type. | |
| 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. | |
| int | ast_presence_state_prov_add (const char *label, ast_presence_state_prov_cb_type callback) | 
| Add presence state provider. | |
| int | ast_presence_state_prov_del (const char *label) | 
| Remove presence state provider. | |
| struct stasis_topic * | ast_presence_state_topic_all (void) | 
| Get presence state topic. | |
| struct stasis_topic * | ast_presence_state_topic_cached (void) | 
| Get caching presence state topic. | |
| enum ast_presence_state | ast_presence_state_val (const char *val) | 
| Convert presence state from text to integer value. | |
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 1 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 224 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 106 of file presencestate.c.
References ARRAY_LEN, and state2string.
Referenced by action_presencestate(), exten_state_publisher_state_cb(), handle_cli_presencestate_list(), handle_show_hint(), handle_show_hints(), manager_state_cb(), pidf_supplement_body(), presence_read(), and presence_state_to_ami().
| 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 373 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 353 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 339 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 498 of file presencestate.c.
References ast_presence_state_message_type(), ast_register_cleanup(), AST_TEST_REGISTER, presence_state_cache, presence_state_engine_cleanup(), presence_state_get_id(), presence_state_topic_all, presence_state_topic_cached, 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(), and presence_state_get_id().
| 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 229 of file presencestate.c.
References ast_presence_state_helper().
Referenced by 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 234 of file presencestate.c.
References ast_calloc, ast_copy_string(), AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, callback(), presence_state_provider::label, presence_state_provider::list, 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 251 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, presence_state_provider::list, 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 368 of file presencestate.c.
References presence_state_topic_all.
Referenced by load_module(), load_pbx(), 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 378 of file presencestate.c.
References presence_state_topic_cached, and 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 117 of file presencestate.c.
References ARRAY_LEN, AST_PRESENCE_INVALID, and state2string.
Referenced by parse_data().