Asterisk - The Open Source Telephony Project  18.5.0
conf_state.c
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2012, Terry Wilson
5  *
6  * Terry Wilson <[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  * Please follow coding guidelines
19  * http://svn.digium.com/view/asterisk/trunk/doc/CODING-GUIDELINES
20  */
21 
22 /*! \file
23  *
24  * \brief Confbridge state handling
25  *
26  * \author\verbatim Terry Wilson <[email protected]> \endverbatim
27  *
28  * This file contains functions that are used from multiple conf_state
29  * files for handling stage change behavior.
30  *
31  * \ingroup applications
32  */
33 
34 /*** MODULEINFO
35  <support_level>core</support_level>
36  ***/
37 
38 #include "asterisk.h"
39 
40 #include "asterisk/logger.h"
41 #include "asterisk/test.h"
42 #include "include/conf_state.h"
43 #include "include/confbridge.h"
44 
46 {
47  ast_log(LOG_ERROR, "Invalid event for confbridge user '%s'\n", user->u_profile.name);
48 }
49 
50 /*!
51  * \internal
52  * \brief Mute the user and play MOH if the user requires it.
53  *
54  * \param user Conference user to mute and optionally start MOH on.
55  *
56  * \return Nothing
57  */
59 {
60  /* Start music on hold if needed */
62  conf_moh_start(user);
63  }
65 }
66 
68 {
69  conf_add_user_waiting(user->conference, user);
72 }
73 
75 {
77  if (user->playing_moh) {
78  conf_moh_stop(user);
79  }
80 }
81 
82 void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate)
83 {
84  ast_debug(1, "Changing conference '%s' state from %s to %s\n", user->conference->name, user->conference->state->name, newstate->name);
85  ast_test_suite_event_notify("CONF_CHANGE_STATE", "Conference: %s\r\nOldState: %s\r\nNewState: %s\r\n",
86  user->conference->name,
87  user->conference->state->name,
88  newstate->name);
89  if (user->conference->state->exit) {
90  user->conference->state->exit(user);
91  }
92  user->conference->state = newstate;
93  if (user->conference->state->entry) {
94  user->conference->state->entry(user);
95  }
96 }
static void conf_mute_moh_inactive_waitmarked(struct confbridge_user *user)
Definition: conf_state.c:58
int conf_add_post_join_action(struct confbridge_user *user, int(*func)(struct confbridge_user *user))
Queue a function to run with the given conference bridge user as an argument once the state transitio...
Asterisk main include file. File version handling, generic pbx functions.
unsigned int playing_moh
Definition: confbridge.h:283
void conf_default_leave_waitmarked(struct confbridge_user *user)
Logic to execute every time a waitmarked user leaves an unmarked conference.
Definition: conf_state.c:74
struct confbridge_conference * conference
Definition: confbridge.h:272
#define ast_test_flag(p, flag)
Definition: utils.h:63
void conf_remove_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user)
Remove a conference bridge user from the waiting conference users in the conference.
Test Framework API.
void conf_update_user_mute(struct confbridge_user *user)
Update the actual mute status of the user and set it on the bridge.
const char * name
Definition: conf_state.h:49
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
conference_entry_fn entry
Definition: conf_state.h:56
void conf_default_join_waitmarked(struct confbridge_user *user)
Logic to execute every time a waitmarked user joins an unmarked conference.
Definition: conf_state.c:67
struct confbridge_state * state
Definition: confbridge.h:246
#define ast_test_suite_event_notify(s, f,...)
Definition: test.h:196
void conf_moh_start(struct confbridge_user *user)
Start MOH for the conference user.
#define LOG_ERROR
Definition: logger.h:285
void conf_moh_stop(struct confbridge_user *user)
Stop MOH for the conference user.
void conf_add_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user)
Add a conference bridge user as an waiting user of the conference.
int conf_handle_inactive_waitmarked(struct confbridge_user *user)
Handle actions every time a waitmarked user joins w/o a marked user present.
structure to hold users read from users.conf
Confbridge state handling.
A conference state object to hold the various state callback functions.
Definition: conf_state.h:48
Support for logging to various files, console and syslog Configuration in file logger.conf.
void conf_invalid_event_fn(struct confbridge_user *user)
A handler for join/leave events that are invalid in a particular state.
Definition: conf_state.c:45
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:153
The structure that represents a conference bridge user.
Definition: confbridge.h:271
struct user_profile u_profile
Definition: confbridge.h:274
char name[MAX_CONF_NAME]
Definition: confbridge.h:245
conference_exit_fn exit
Definition: conf_state.h:57
void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate)
Execute conference state transition because of a user action.
Definition: conf_state.c:82