res_stasis_answer.c 1.8 KB

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