|
Asterisk - The Open Source Telephony Project GIT-master-6144b6b
|
#include "asterisk.h"#include "asterisk/_private.h"#include "asterisk/module.h"#include "asterisk/extension_state.h"#include "asterisk/pbx.h"#include "asterisk/stasis.h"#include "asterisk/stasis_message_router.h"#include "asterisk/astobj2.h"#include "asterisk/lock.h"#include "asterisk/vector.h"
Go to the source code of this file.
Data Structures | |
| struct | extension_state_legacy_state_cb |
Functions | |
| int | ast_extension_state (struct ast_channel *c, const char *context, const char *exten) |
| Uses hint and devicestate callback to get the state of an extension. | |
| int | ast_extension_state_add (const char *context, const char *exten, ast_state_cb_type change_cb, void *data) |
| Add watcher for extension states. | |
| int | ast_extension_state_add_destroy (const char *context, const char *exten, ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data) |
| Add watcher for extension states with destructor. | |
| int | ast_extension_state_add_destroy_extended (const char *context, const char *exten, ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data) |
| Add watcher for extended extension states with destructor. | |
| int | ast_extension_state_add_extended (const char *context, const char *exten, ast_state_cb_type change_cb, void *data) |
| Add watcher for extended extension states. | |
| int | ast_extension_state_del (int id, ast_state_cb_type change_cb) |
| Deletes a state change watcher by ID. | |
| int | ast_extension_state_extended (struct ast_channel *c, const char *context, const char *exten, struct ao2_container **device_state_info) |
| Uses hint and devicestate callback to get the extended state of an extension. | |
| int | ast_extension_state_legacy_init (void) |
| int | ast_hint_presence_state (struct ast_channel *c, const char *context, const char *exten, char **subtype, char **message) |
| Uses hint and presence state callback to get the presence state of an extension. | |
| static void | device_state_info_destroy (void *obj) |
| static int | extension_state_legacy_add_destroy (const char *context, const char *exten, ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data, int extended) |
| static void | extension_state_legacy_cleanup (void) |
| static struct ao2_container * | extension_state_legacy_create_device_state_info (struct ast_extension_state_device_snapshot *device_snapshot) |
| static void | extension_state_legacy_remove_cb (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
| static void | extension_state_legacy_state_cb_destroy (void *obj) |
| static void | extension_state_legacy_subscription_change_cb (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
| static void | extension_state_legacy_update_cb (void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) |
Variables | ||
| struct { | ||
| size_t current | ||
| struct extension_state_legacy_state_cb ** elems | ||
| size_t max | ||
| } | extension_state_legacy_callbacks | |
| Legacy callbacks, the index of it in the vector is the id given to the API user for per-extension. | ||
| static ast_mutex_t | extension_state_legacy_callbacks_lock = AST_MUTEX_INIT_VALUE | |
| Lock to protect the callbacks vector. | ||
| int ast_extension_state | ( | struct ast_channel * | c, |
| const char * | context, | ||
| const char * | exten | ||
| ) |
Uses hint and devicestate callback to get the state of an extension.
| c | this is not important |
| context | which context to look in |
| exten | which extension to get state |
Definition at line 55 of file extension_state_legacy.c.
References ao2_ref, ast_extension_state_get_latest_device_snapshot(), c, and ast_extension_state_device_snapshot::state.
Referenced by action_extensionstate(), extstate_read(), and get_queue_member_status().
| int ast_extension_state_add | ( | const char * | context, |
| const char * | exten, | ||
| ast_state_cb_type | change_cb, | ||
| void * | data | ||
| ) |
Add watcher for extension states.
| context | which context to look in |
| exten | which extension to get state |
| change_cb | callback to call if state changed |
| data | to pass to callback |
| -1 | on failure |
| 0 | Global watcher added successfully |
| ID | on success |
Definition at line 375 of file extension_state_legacy.c.
References extension_state_legacy_add_destroy(), and NULL.
Referenced by __init_manager(), create_queue_member(), and publisher_start().
| int ast_extension_state_add_destroy | ( | const char * | context, |
| const char * | exten, | ||
| ast_state_cb_type | change_cb, | ||
| ast_state_cb_destroy_type | destroy_cb, | ||
| void * | data | ||
| ) |
Add watcher for extension states with destructor.
| context | which context to look in |
| exten | which extension to get state |
| change_cb | callback to call if state changed |
| destroy_cb | callback to call when the watcher is destroyed. |
| data | to pass to callbacks |
| -1 | on failure |
| 0 | Global watcher added successfully |
| ID | on success |
Definition at line 369 of file extension_state_legacy.c.
References extension_state_legacy_add_destroy().
| int ast_extension_state_add_destroy_extended | ( | const char * | context, |
| const char * | exten, | ||
| ast_state_cb_type | change_cb, | ||
| ast_state_cb_destroy_type | destroy_cb, | ||
| void * | data | ||
| ) |
Add watcher for extended extension states with destructor.
| context | which context to look in |
| exten | which extension to get state |
| change_cb | callback to call if state changed |
| destroy_cb | callback to call when the watcher is destroyed. |
| data | to pass to callbacks |
| -1 | on failure |
| 0 | Global watcher added successfully |
| ID | on success |
Definition at line 381 of file extension_state_legacy.c.
References extension_state_legacy_add_destroy().
Referenced by subscription_established().
| int ast_extension_state_add_extended | ( | const char * | context, |
| const char * | exten, | ||
| ast_state_cb_type | change_cb, | ||
| void * | data | ||
| ) |
Add watcher for extended extension states.
| context | which context to look in |
| exten | which extension to get state |
| change_cb | callback to call if state changed |
| data | to pass to callback |
| -1 | on failure |
| 0 | Global watcher added successfully |
| ID | on success |
Definition at line 387 of file extension_state_legacy.c.
References extension_state_legacy_add_destroy(), and NULL.
| int ast_extension_state_del | ( | int | id, |
| ast_state_cb_type | change_cb | ||
| ) |
Deletes a state change watcher by ID.
| id | of the state watcher to delete (0 for global watcher) |
| change_cb | callback to call if state changed (Used if id == 0 (global)) |
| 0 | success |
| -1 | failure |
Definition at line 393 of file extension_state_legacy.c.
References ao2_ref, ast_mutex_lock, ast_mutex_unlock, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, extension_state_legacy_state_cb::change_cb, extension_state_legacy_callbacks, extension_state_legacy_callbacks_lock, NULL, extension_state_legacy_state_cb::router, and stasis_message_router_unsubscribe().
Referenced by destroy_queue_member_cb(), subscription_shutdown(), and unload_module().
| int ast_extension_state_extended | ( | struct ast_channel * | c, |
| const char * | context, | ||
| const char * | exten, | ||
| struct ao2_container ** | device_state_info | ||
| ) |
Uses hint and devicestate callback to get the extended state of an extension.
| c | this is not important | |
| context | which context to look in | |
| exten | which extension to get state | |
| [out] | device_state_info | ptr to an ao2_container with extended state info, must be unref'd after use. |
Definition at line 143 of file extension_state_legacy.c.
References ao2_ref, ast_extension_state_get_latest_device_snapshot(), c, extension_state_legacy_create_device_state_info(), and ast_extension_state_device_snapshot::state.
Referenced by exten_state_data_alloc().
| int ast_extension_state_legacy_init | ( | void | ) |
Provided by extension_state_legacy.c
Definition at line 470 of file extension_state_legacy.c.
References ast_register_cleanup(), AST_VECTOR_INIT, extension_state_legacy_callbacks, and extension_state_legacy_cleanup().
Referenced by asterisk_daemon().
| int ast_hint_presence_state | ( | struct ast_channel * | c, |
| const char * | context, | ||
| const char * | exten, | ||
| char ** | subtype, | ||
| char ** | message | ||
| ) |
Uses hint and presence state callback to get the presence state of an extension.
| c | this is not important | |
| context | which context to look in | |
| exten | which extension to get state | |
| [out] | subtype | Further information regarding the presence returned |
| [out] | message | Custom message further describing current presence |
Definition at line 71 of file extension_state_legacy.c.
References ao2_ref, ast_extension_state_get_latest_presence_snapshot(), ast_strdup, c, ast_extension_state_presence_snapshot::presence_message, ast_extension_state_presence_snapshot::presence_state, and ast_extension_state_presence_snapshot::presence_subtype.
Referenced by exten_state_data_alloc().
|
static |
Definition at line 100 of file extension_state_legacy.c.
References ao2_cleanup.
Referenced by extension_state_legacy_create_device_state_info().
|
static |
Definition at line 271 of file extension_state_legacy.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ao2_cleanup, ao2_ref, ast_extension_state_remove_message_type(), ast_extension_state_topic(), ast_extension_state_topic_all(), ast_extension_state_update_message_type(), ast_mutex_lock, ast_mutex_unlock, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, extension_state_legacy_state_cb::change_cb, extension_state_legacy_state_cb::data, extension_state_legacy_state_cb::destroy_cb, extension_state_legacy_state_cb::extended, extension_state_legacy_callbacks, extension_state_legacy_callbacks_lock, extension_state_legacy_remove_cb(), extension_state_legacy_state_cb_destroy(), extension_state_legacy_subscription_change_cb(), extension_state_legacy_update_cb(), id, extension_state_legacy_state_cb::id, NULL, extension_state_legacy_state_cb::router, stasis_message_router_add(), stasis_message_router_create, stasis_message_router_create_pool, and stasis_subscription_change_type().
Referenced by ast_extension_state_add(), ast_extension_state_add_destroy(), ast_extension_state_add_destroy_extended(), and ast_extension_state_add_extended().
|
static |
Definition at line 450 of file extension_state_legacy.c.
References ao2_ref, ast_mutex_lock, ast_mutex_unlock, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, extension_state_legacy_callbacks, extension_state_legacy_callbacks_lock, NULL, extension_state_legacy_state_cb::router, and stasis_message_router_unsubscribe_and_join().
Referenced by ast_extension_state_legacy_init().
|
static |
Definition at line 114 of file extension_state_legacy.c.
References ast_extension_state_device_snapshot::additional_devices, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_container_alloc_list, ao2_link, ao2_ref, ast_extension_state_get_device_causing_channel(), AST_VECTOR_GET, AST_VECTOR_SIZE, ast_device_state_info::causing_channel, ast_extension_state_device_state_info::device, ast_device_state_info::device_name, ast_device_state_info::device_state, device_state_info_destroy(), NULL, and ast_extension_state_device_state_info::state.
Referenced by ast_extension_state_extended(), and extension_state_legacy_update_cb().
|
static |
Definition at line 246 of file extension_state_legacy.c.
References AST_EXTENSION_REMOVED, AST_HINT_UPDATE_DEVICE, extension_state_legacy_state_cb::change_cb, ast_extension_state_remove_message::context, extension_state_legacy_state_cb::data, ast_extension_state_remove_message::extension, and stasis_message_data().
Referenced by extension_state_legacy_add_destroy().
|
static |
Definition at line 188 of file extension_state_legacy.c.
References extension_state_legacy_state_cb::data, extension_state_legacy_state_cb::destroy_cb, and extension_state_legacy_state_cb::id.
Referenced by extension_state_legacy_add_destroy().
|
static |
Definition at line 174 of file extension_state_legacy.c.
References ao2_cleanup, stasis_subscription_final_message(), and sub.
Referenced by extension_state_legacy_add_destroy().
|
static |
Definition at line 205 of file extension_state_legacy.c.
References ao2_cleanup, AST_HINT_UPDATE_DEVICE, AST_HINT_UPDATE_PRESENCE, extension_state_legacy_state_cb::change_cb, ast_extension_state_update_message::context, extension_state_legacy_state_cb::data, extension_state_legacy_state_cb::extended, ast_extension_state_update_message::extension, extension_state_legacy_create_device_state_info(), ast_extension_state_update_message::new_device_snapshot, ast_extension_state_update_message::new_presence_snapshot, ast_extension_state_update_message::old_device_snapshot, ast_extension_state_update_message::old_presence_snapshot, ast_extension_state_presence_snapshot::presence_message, ast_extension_state_presence_snapshot::presence_state, ast_extension_state_presence_snapshot::presence_subtype, S_OR, stasis_message_data(), and ast_extension_state_device_snapshot::state.
Referenced by extension_state_legacy_add_destroy().
| size_t current |
Definition at line 53 of file extension_state_legacy.c.
| struct extension_state_legacy_state_cb* * elems |
Definition at line 53 of file extension_state_legacy.c.
| struct { ... } extension_state_legacy_callbacks |
Legacy callbacks, the index of it in the vector is the id given to the API user for per-extension.
Referenced by ast_extension_state_del(), ast_extension_state_legacy_init(), extension_state_legacy_add_destroy(), and extension_state_legacy_cleanup().
|
static |
Lock to protect the callbacks vector.
Definition at line 50 of file extension_state_legacy.c.
Referenced by ast_extension_state_del(), extension_state_legacy_add_destroy(), and extension_state_legacy_cleanup().
| size_t max |
Definition at line 53 of file extension_state_legacy.c.