conf_state.c

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2012, Terry Wilson
00005  *
00006  * Terry Wilson <twilson@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  *
00018  * Please follow coding guidelines
00019  * http://svn.digium.com/view/asterisk/trunk/doc/CODING-GUIDELINES
00020  */
00021 
00022 /*! \file
00023  *
00024  * \brief Confbridge state handling
00025  *
00026  * \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
00027  *
00028  * This file contains functions that are used from multiple conf_state
00029  * files for handling stage change behavior.
00030  *
00031  * \ingroup applications
00032  */
00033 
00034 /*** MODULEINFO
00035    <support_level>core</support_level>
00036  ***/
00037 
00038 #include "asterisk.h"
00039 
00040 #include "asterisk/logger.h"
00041 #include "asterisk/test.h"
00042 #include "include/conf_state.h"
00043 #include "include/confbridge.h"
00044 
00045 void conf_invalid_event_fn(struct confbridge_user *user)
00046 {
00047    ast_log(LOG_ERROR, "Invalid event for confbridge user '%s'\n", user->u_profile.name);
00048 }
00049 
00050 /*!
00051  * \internal
00052  * \brief Mute the user and play MOH if the user requires it.
00053  *
00054  * \param user Conference user to mute and optionally start MOH on.
00055  *
00056  * \return Nothing
00057  */
00058 static void conf_mute_moh_inactive_waitmarked(struct confbridge_user *user)
00059 {
00060    /* Start music on hold if needed */
00061    if (ast_test_flag(&user->u_profile, USER_OPT_MUSICONHOLD)) {
00062       conf_moh_start(user);
00063    }
00064    conf_update_user_mute(user);
00065 }
00066 
00067 void conf_default_join_waitmarked(struct confbridge_user *user)
00068 {
00069    conf_add_user_waiting(user->conference, user);
00070    conf_mute_moh_inactive_waitmarked(user);
00071    conf_add_post_join_action(user, conf_handle_inactive_waitmarked);
00072 }
00073 
00074 void conf_default_leave_waitmarked(struct confbridge_user *user)
00075 {
00076    conf_remove_user_waiting(user->conference, user);
00077    if (user->playing_moh) {
00078       conf_moh_stop(user);
00079    }
00080 }
00081 
00082 void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate)
00083 {
00084    ast_debug(1, "Changing conference '%s' state from %s to %s\n", user->conference->name, user->conference->state->name, newstate->name);
00085    ast_test_suite_event_notify("CONF_CHANGE_STATE", "Conference: %s\r\nOldState: %s\r\nNewState: %s\r\n",
00086          user->conference->name,
00087          user->conference->state->name,
00088          newstate->name);
00089    if (user->conference->state->exit) {
00090       user->conference->state->exit(user);
00091    }
00092    user->conference->state = newstate;
00093    if (user->conference->state->entry) {
00094       user->conference->state->entry(user);
00095    }
00096 }

Generated on Thu Apr 16 06:27:31 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6