Asterisk - The Open Source Telephony Project  18.5.0
res_stasis_answer.c
Go to the documentation of this file.
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"
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",
41  return ast_raw_answer(chan);
42 }
43 
45 {
46  int retval;
47 
48  ast_debug(3, "%s: Sending answer command\n",
50 
52 
53  if (retval != 0) {
54  ast_log(LOG_WARNING, "%s: Failed to answer channel\n",
56  return -1;
57  }
58 
59  return 0;
60 }
61 
62 static int load_module(void)
63 {
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 );
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
#define LOG_WARNING
Definition: logger.h:274
int stasis_app_send_command(struct stasis_app_control *control, stasis_app_command_cb command, void *data, command_data_destructor_fn data_destructor)
Invokes a command on a control&#39;s channel.
Definition: control.c:898
static int app_control_answer(struct stasis_app_control *control, struct ast_channel *chan, void *data)
#define NULL
Definition: resample.c:96
int ast_raw_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2699
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
int stasis_app_control_answer(struct stasis_app_control *control)
Answer the channel associated with this control.
static int load_module(void)
Backend API for implementing components of res_stasis.
const char * stasis_app_control_get_channel_id(const struct stasis_app_control *control)
Returns the uniqueid of the channel associated with this control.
Definition: control.c:1430
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
static int unload_module(void)
void * data
Definition: datastore.h:70
static ENTRY retval
Definition: hsearch.c:50
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
Asterisk module definitions.