command.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #ifndef _ASTERISK_RES_STASIS_COMMAND_H
  19. #define _ASTERISK_RES_STASIS_COMMAND_H
  20. /*! \file
  21. *
  22. * \brief Internal API for the Stasis application commands.
  23. *
  24. * \author David M. Lee, II <dlee@digium.com>
  25. * \since 12
  26. */
  27. #include "asterisk/stasis_app_impl.h"
  28. struct stasis_app_command;
  29. struct stasis_app_command *command_create(
  30. stasis_app_command_cb callback, void *data,
  31. command_data_destructor_fn data_destructor);
  32. void command_complete(struct stasis_app_command *command, int retval);
  33. void command_invoke(struct stasis_app_command *command,
  34. struct stasis_app_control *control, struct ast_channel *chan);
  35. int command_join(struct stasis_app_command *command);
  36. /*!
  37. * \brief Queue a Stasis() prestart command for a channel
  38. *
  39. * \pre chan must be locked
  40. *
  41. * \param chan The channel on which to queue the prestart command
  42. * \param command_fn The callback to call for the command
  43. * \param data The data to pass to the command callback
  44. * \param data_destructor Optional function which will be called on
  45. * the data in either the event of command completion or failure
  46. * to schedule or complete the command
  47. *
  48. * \retval zero on success
  49. * \retval non-zero on failure
  50. */
  51. int command_prestart_queue_command(struct ast_channel *chan,
  52. stasis_app_command_cb command_fn, void *data,
  53. command_data_destructor_fn data_destructor);
  54. /*!
  55. * \brief Get the Stasis() prestart commands for a channel
  56. *
  57. * \pre chan must be locked
  58. *
  59. * \param chan The channel from which to get prestart commands
  60. *
  61. * \return The command prestart container for chan (must be ao2_cleanup()'d)
  62. */
  63. struct ao2_container *command_prestart_get_container(struct ast_channel *chan);
  64. #endif /* _ASTERISK_RES_STASIS_CONTROL_H */