Debian Codegraph @

res/res_stasis_answer.c

raw symbols SCIP
1 /*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2013, Digium, Inc.
5 *
6 * David M. Lee, II <[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 /*! \file
20 *
21 * \brief Stasis application control support.
22 *
23 * \author David M. Lee, II <[email protected]>
24 */
25
26 /*** MODULEINFO
27 <depend type="module">res_stasis</depend>
28 <support_level>core</support_level>
29 ***/
30
31 #include "asterisk.h"
32
33 #include "asterisk/module.h"
34 #include "asterisk/stasis_app_impl.h"
35
36 static int app_control_answer(struct stasis_app_control *control,
37 struct ast_channel *chan, void *data)
38 {
39 ast_debug(3, "%s: Answering\n",
40 stasis_app_control_get_channel_id(control));
41 return ast_raw_answer(chan);
42 }
43
44 int stasis_app_control_answer(struct stasis_app_control *control)
45 {
46 int retval;
47
48 ast_debug(3, "%s: Sending answer command\n",
49 stasis_app_control_get_channel_id(control));
50
51 retval = stasis_app_send_command(control, app_control_answer, NULL, NULL);
52
53 if (retval != 0) {
54 ast_log(LOG_WARNING, "%s: Failed to answer channel\n",
55 stasis_app_control_get_channel_id(control));
56 return -1;
57 }
58
59 return 0;
60 }
61
62 static int load_module(void)
63 {
64 return AST_MODULE_LOAD_SUCCESS;
65 }
66
67 static int unload_module(void)
68 {
69 return 0;
70 }
71
72 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Stasis application answer support",
73 .support_level = AST_MODULE_SUPPORT_CORE,
74 .load = load_module,
75 .unload = unload_module,
76 .requires = "res_stasis",
77 );