Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Stasis out-of-call text message support. More...
Go to the source code of this file.
Typedefs | |
typedef int(* | message_received_cb) (const char *endpoint_id, struct ast_json *json_msg, void *pvt) |
Callback handler for when a message is received from the core. More... | |
Functions | |
int | messaging_app_subscribe_endpoint (const char *app_name, struct ast_endpoint *endpoint, message_received_cb callback, void *pvt) |
Subscribe an application to an endpoint for messages. More... | |
void | messaging_app_unsubscribe_endpoint (const char *app_name, const char *endpoint_id) |
Subscribe for messages from a particular endpoint. More... | |
int | messaging_cleanup (void) |
Tidy up the messaging layer. More... | |
int | messaging_init (void) |
Initialize the messaging layer. More... | |
typedef int(* message_received_cb) (const char *endpoint_id, struct ast_json *json_msg, void *pvt) |
Callback handler for when a message is received from the core.
endpoint_id | The ID of the endpoint that we received the message from |
json_msg | JSON representation of the text message |
pvt | ao2 ref counted pvt passed during registration |
0 | the message was handled |
non-zero | the message was not handled |
Definition at line 41 of file messaging.h.
int messaging_app_subscribe_endpoint | ( | const char * | app_name, |
struct ast_endpoint * | endpoint, | ||
message_received_cb | callback, | ||
void * | pvt | ||
) |
Subscribe an application to an endpoint for messages.
app_name | The name of the Stasis Message Bus API application to subscribe to endpoint |
endpoint | The endpoint object to subscribe to |
callback | The callback to call when a message is received |
pvt | An ao2 ref counted object that will be passed to the callback. |
0 | subscription was successful |
-1 | subscription failed |
Definition at line 493 of file messaging.c.
References ao2_cleanup, ao2_lock, ao2_ref, ao2_unlock, app_name(), application_tuple_alloc(), ast_debug, ast_endpoint_get_id(), ast_test_suite_event_notify, AST_VECTOR_APPEND, application_tuple::callback, get_or_create_subscription(), is_app_subscribed(), NULL, application_tuple::pvt, RAII_VAR, and sub.
Referenced by app_subscribe_endpoint().
void messaging_app_unsubscribe_endpoint | ( | const char * | app_name, |
const char * | endpoint_id | ||
) |
Subscribe for messages from a particular endpoint.
app_name | Name of the stasis application to unsubscribe from messaging |
endpoint_id | The ID of the endpoint we no longer care about |
Definition at line 423 of file messaging.c.
References ao2_cleanup, ao2_lock, ao2_ref, ao2_unlink, ao2_unlock, app_name(), application_tuple_cmp(), ast_debug, ast_endpoint_find_by_id(), ast_endpoint_get_id(), ast_endpoint_get_resource(), ast_rwlock_unlock, ast_rwlock_wrlock, ast_strlen_zero(), ast_test_suite_event_notify, AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_REMOVE_CMP_UNORDERED, AST_VECTOR_SIZE, endpoint_subscriptions, get_subscription(), is_app_subscribed(), messaging_subscription_cmp(), NULL, RAII_VAR, sub, tech_subscriptions, tech_subscriptions_lock, and TECH_WILDCARD.
Referenced by unsubscribe().
int messaging_cleanup | ( | void | ) |
Tidy up the messaging layer.
0 | success |
-1 | failure |
Definition at line 529 of file messaging.c.
References ao2_ref, ari_msg_handler, ast_msg_handler_unregister(), ast_rwlock_destroy, AST_VECTOR_FREE, endpoint_subscriptions, tech_subscriptions, and tech_subscriptions_lock.
Referenced by unload_module().
int messaging_init | ( | void | ) |
Initialize the messaging layer.
0 | success |
-1 | failure |
Definition at line 539 of file messaging.c.
References AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_ref, ao2_t_container_alloc_hash, ari_msg_handler, ast_msg_handler_register(), ast_rwlock_destroy, ast_rwlock_init, AST_VECTOR_FREE, AST_VECTOR_INIT, endpoint_subscriptions, ENDPOINTS_NUM_BUCKETS, message_subscription_compare_cb(), message_subscription_hash_cb(), NULL, tech_subscriptions, and tech_subscriptions_lock.
Referenced by load_module().