conf_state_inactive.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 2012, Terry Wilson
  5. *
  6. * Terry Wilson <twilson@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. * Please follow coding guidelines
  19. * http://svn.digium.com/view/asterisk/trunk/doc/CODING-GUIDELINES
  20. */
  21. /*! \file
  22. *
  23. * \brief Confbridge state handling for the INACTIVE state
  24. *
  25. * \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
  26. *
  27. * \ingroup applications
  28. */
  29. /*** MODULEINFO
  30. <support_level>core</support_level>
  31. ***/
  32. #include "include/confbridge.h"
  33. #include "include/conf_state.h"
  34. static void join_unmarked(struct confbridge_user *user);
  35. static void join_marked(struct confbridge_user *user);
  36. static void leave_waitmarked(struct confbridge_user *user);
  37. struct confbridge_state STATE_INACTIVE = {
  38. .name = "INACTIVE",
  39. .join_unmarked = join_unmarked,
  40. .join_waitmarked = conf_default_join_waitmarked,
  41. .join_marked = join_marked,
  42. .leave_waitmarked = leave_waitmarked,
  43. };
  44. struct confbridge_state *CONF_STATE_INACTIVE = &STATE_INACTIVE;
  45. static void join_unmarked(struct confbridge_user *user)
  46. {
  47. conf_add_user_active(user->conference, user);
  48. conf_add_post_join_action(user, conf_handle_only_person);
  49. conf_change_state(user, CONF_STATE_SINGLE);
  50. }
  51. static void join_marked(struct confbridge_user *user)
  52. {
  53. conf_add_user_marked(user->conference, user);
  54. conf_update_user_mute(user);
  55. conf_change_state(user, CONF_STATE_MULTI_MARKED);
  56. }
  57. static void leave_waitmarked(struct confbridge_user *user)
  58. {
  59. conf_default_leave_waitmarked(user);
  60. if (user->conference->waitingusers == 0) {
  61. conf_change_state(user, CONF_STATE_EMPTY);
  62. }
  63. }