Debian Codegraph @

res/stasis/messaging.h

raw symbols SCIP
1 /*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2014, Digium, Inc.
5 *
6 * Matt Jordan <[email protected]>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19 #ifndef _ASTERISK_RES_STASIS_MESSAGING_H
20 #define _ASTERISK_RES_STASIS_MESSAGING_H
21
22 /*!
23 * \file
24 *
25 * \brief Stasis out-of-call text message support
26 *
27 * \author Matt Jordan <[email protected]>
28 * \since 12.4.0
29 */
30
31 /*!
32 * \brief Callback handler for when a message is received from the core
33 *
34 * \param endpoint_id The ID of the endpoint that we received the message from
35 * \param json_msg JSON representation of the text message
36 * \param pvt ao2 ref counted pvt passed during registration
37 *
38 * \retval 0 the message was handled
39 * \retval non-zero the message was not handled
40 */
41 typedef int (* message_received_cb)(const char *endpoint_id, struct ast_json *json_msg, void *pvt);
42
43 /*!
44 * \brief Subscribe for messages from a particular endpoint
45 *
46 * \param app_name Name of the stasis application to unsubscribe from messaging
47 * \param endpoint_id The ID of the endpoint we no longer care about
48 */
49 void messaging_app_unsubscribe_endpoint(const char *app_name, const char *endpoint_id);
50
51 /*!
52 * \brief Subscribe an application to an endpoint for messages
53 *
54 * \param app_name The name of the \ref stasis application to subscribe to \c endpoint
55 * \param endpoint The endpoint object to subscribe to
56 * \param callback The callback to call when a message is received
57 * \param pvt An ao2 ref counted object that will be passed to the callback.
58 *
59 * \retval 0 subscription was successful
60 * \retval -1 subscription failed
61 */
62 int messaging_app_subscribe_endpoint(const char *app_name, struct ast_endpoint *endpoint, message_received_cb callback, void *pvt);
63
64 /*!
65 * \brief Tidy up the messaging layer
66 *
67 * \retval 0 success
68 * \retval -1 failure
69 */
70 int messaging_cleanup(void);
71
72 /*!
73 * \brief Initialize the messaging layer
74 *
75 * \retval 0 success
76 * \retval -1 failure
77 */
78 int messaging_init(void);
79
80 #endif /* #define _ASTERISK_RES_STASIS_MESSAGING_H */