[asterisk-commits] dvossel: branch dvossel/hd_confbridge r309299 - in /team/dvossel/hd_confbridg...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 2 14:50:01 CST 2011
Author: dvossel
Date: Wed Mar 2 14:49:57 2011
New Revision: 309299
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=309299
Log:
conversion of ConfBridge to use new bridge and menu profiles
Modified:
team/dvossel/hd_confbridge/apps/app_confbridge.c
team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
team/dvossel/hd_confbridge/configs/confbridge.conf.sample
Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=309299&r1=309298&r2=309299
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Wed Mar 2 14:49:57 2011
@@ -60,41 +60,12 @@
<parameter name="confno">
<para>The conference number</para>
</parameter>
- <parameter name="options">
- <optionlist>
- <option name="a">
- <para>Set admin mode.</para>
- </option>
- <option name="A">
- <para>Set marked mode.</para>
- </option>
- <option name="c">
- <para>Announce user(s) count on joining a conference.</para>
- </option>
- <option name="m">
- <para>Set initially muted.</para>
- </option>
- <option name="M" hasparams="optional">
- <para>Enable music on hold when the conference has a single caller. Optionally,
- specify a musiconhold class to use. If one is not provided, it will use the
- channel's currently set music class, or <literal>default</literal>.</para>
- <argument name="class" required="true" />
- </option>
- <option name="1">
- <para>Do not play message when first person enters</para>
- </option>
- <option name="s">
- <para>Present menu (user or admin) when <literal>*</literal> is received
- (send to menu).</para>
- </option>
- <option name="w">
- <para>Wait until the marked user enters the conference.</para>
- </option>
- <option name="q">
- <para>Quiet mode (don't play enter/leave sounds).</para>
- </option>
- </optionlist>
- </parameter>
+ <parameter name="bridge_profile">
+ <para>The bridge profile name from confbridge.conf</para>
+ </parameter>
+ <parameter name="menu">
+ <para>The name of the DTMF menu in confbridge.conf to be applied to this channel.</para>
+ </parameter>
</syntax>
<description>
<para>Enters the user into a specified conference bridge. The user can exit the conference by hangup only.</para>
@@ -116,18 +87,6 @@
static const char app[] = "ConfBridge";
-AST_APP_OPTIONS(app_opts,{
- AST_APP_OPTION('A', OPTION_MARKEDUSER),
- AST_APP_OPTION('a', OPTION_ADMIN),
- AST_APP_OPTION('c', OPTION_ANNOUNCEUSERCOUNT),
- AST_APP_OPTION('m', OPTION_STARTMUTED),
- AST_APP_OPTION_ARG('M', OPTION_MUSICONHOLD, OPTION_MUSICONHOLD_CLASS),
- AST_APP_OPTION('1', OPTION_NOONLYPERSON),
- AST_APP_OPTION('s', OPTION_MENU),
- AST_APP_OPTION('w', OPTION_WAITMARKED),
- AST_APP_OPTION('q', OPTION_QUIET),
-});
-
/* Number of buckets our conference bridges container can have */
#define CONFERENCE_BRIDGE_BUCKETS 53
@@ -210,7 +169,7 @@
*/
static void post_join_marked(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
{
- if (ast_test_flag(&conference_bridge_user->flags, OPTION_MARKEDUSER)) {
+ if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MARKEDUSER)) {
struct conference_bridge_user *other_conference_bridge_user = NULL;
/* If we are not the first marked user to join just bail out now */
@@ -223,14 +182,14 @@
if (other_conference_bridge_user == conference_bridge_user) {
continue;
}
- if (ast_test_flag(&other_conference_bridge_user->flags, OPTION_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, other_conference_bridge_user->chan)) {
+ if (ast_test_flag(&other_conference_bridge_user->u_profile, USER_OPT_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, other_conference_bridge_user->chan)) {
ast_moh_stop(other_conference_bridge_user->chan);
ast_bridge_unsuspend(conference_bridge->bridge, other_conference_bridge_user->chan);
}
}
/* Next play the audio file stating they are going to be placed into the conference */
- if (!ast_test_flag(&conference_bridge_user->flags, OPTION_QUIET)) {
+ if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_QUIET)) {
ao2_unlock(conference_bridge);
ast_autoservice_start(conference_bridge_user->chan);
play_sound_file(conference_bridge, "conf-placeintoconf");
@@ -254,14 +213,14 @@
/* Be sure we are muted so we can't talk to anybody else waiting */
conference_bridge_user->features.mute = 1;
/* If we have not been quieted play back that they are waiting for the leader */
- if (!ast_test_flag(&conference_bridge_user->flags, OPTION_QUIET)) {
+ if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_QUIET)) {
play_prompt_to_channel(conference_bridge, conference_bridge_user->chan, "conf-waitforleader");
}
/* Start music on hold if needed */
/* We need to recheck the markedusers value here. play_prompt_to_channel unlocks the conference bridge, potentially
* allowing a marked user to enter while the prompt was playing
*/
- if (!conference_bridge->markedusers && ast_test_flag(&conference_bridge_user->flags, OPTION_MUSICONHOLD)) {
+ if (!conference_bridge->markedusers && ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MUSICONHOLD)) {
ast_moh_start(conference_bridge_user->chan, conference_bridge_user->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
}
}
@@ -280,21 +239,21 @@
/* Play back audio prompt and start MOH if need be if we are the first participant */
if (conference_bridge->users == 1) {
/* If audio prompts have not been quieted or this prompt quieted play it on out */
- if (!ast_test_flag(&conference_bridge_user->flags, OPTION_QUIET | OPTION_NOONLYPERSON)) {
+ if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_QUIET | OPTION_NOONLYPERSON)) {
play_prompt_to_channel(conference_bridge, conference_bridge_user->chan, "conf-onlyperson");
}
/* If we need to start music on hold on the channel do so now */
/* We need to re-check the number of users in the conference bridge here because another conference bridge
* participant could have joined while the above prompt was playing for the first user.
*/
- if (conference_bridge->users == 1 && ast_test_flag(&conference_bridge_user->flags, OPTION_MUSICONHOLD)) {
+ if (conference_bridge->users == 1 && ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MUSICONHOLD)) {
ast_moh_start(conference_bridge_user->chan, conference_bridge_user->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
}
return;
}
/* Announce number of users if need be */
- if (ast_test_flag(&conference_bridge_user->flags, OPTION_ANNOUNCEUSERCOUNT)) {
+ if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ANNOUNCEUSERCOUNT)) {
ao2_unlock(conference_bridge);
announce_user_count(conference_bridge, conference_bridge_user);
ao2_lock(conference_bridge);
@@ -305,7 +264,7 @@
struct conference_bridge_user *first_participant = AST_LIST_FIRST(&conference_bridge->users_list);
/* Temporarily suspend the above participant from the bridge so we have control to stop MOH if needed */
- if (ast_test_flag(&first_participant->flags, OPTION_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, first_participant->chan)) {
+ if (ast_test_flag(&first_participant->u_profile, USER_OPT_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, first_participant->chan)) {
ast_moh_stop(first_participant->chan);
ast_bridge_unsuspend(conference_bridge->bridge, first_participant->chan);
}
@@ -364,8 +323,18 @@
/* Attempt to find an existing conference bridge */
conference_bridge = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+ if (conference_bridge && strcasecmp(conference_bridge->b_profile.name, conference_bridge_user->b_profile.name)) {
+ ast_log(LOG_ERROR, "Conference bridge '%s' found, but user bridge profile %s does not match the conference's bridge profile %s\n",
+ name,
+ conference_bridge_user->b_profile.name,
+ conference_bridge->b_profile.name);
+ ao2_unlock(conference_bridges);
+ ao2_ref(conference_bridge, -1);
+ return NULL;
+ }
+
/* When finding a conference bridge that already exists make sure that it is not locked, and if so that we are not an admin */
- if (conference_bridge && conference_bridge->locked && !ast_test_flag(&conference_bridge_user->flags, OPTION_ADMIN)) {
+ if (conference_bridge && conference_bridge->locked && !ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ADMIN)) {
ao2_unlock(conference_bridges);
ao2_ref(conference_bridge, -1);
ast_debug(1, "Conference bridge '%s' is locked and caller is not an admin\n", name);
@@ -384,6 +353,7 @@
/* Setup conference bridge parameters */
ast_copy_string(conference_bridge->name, name, sizeof(conference_bridge->name));
+ memcpy(&conference_bridge->b_profile, &conference_bridge_user->u_profile, sizeof(conference_bridge->b_profile));
/* Create an actual bridge that will do the audio mixing */
if (!(conference_bridge->bridge = ast_bridge_new(AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_FLAG_SMART))) {
@@ -417,7 +387,7 @@
conference_bridge->users++;
/* If the caller is a marked user bump up the count */
- if (ast_test_flag(&conference_bridge_user->flags, OPTION_MARKEDUSER)) {
+ if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MARKEDUSER)) {
conference_bridge->markedusers++;
}
@@ -427,7 +397,8 @@
}
/* If the caller is a marked user or is waiting for a marked user to enter pass 'em off, otherwise pass them off to do regular joining stuff */
- if (ast_test_flag(&conference_bridge_user->flags, OPTION_MARKEDUSER | OPTION_WAITMARKED)) {
+ if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MARKEDUSER) ||
+ ast_test_flag(&conference_bridge_user->b_profile, BRIDGE_OPT_WAITMARKED)) {
post_join_marked(conference_bridge, conference_bridge_user);
} else {
post_join_unmarked(conference_bridge, conference_bridge_user);
@@ -450,7 +421,7 @@
ao2_lock(conference_bridge);
/* If this caller is a marked user bump down the count */
- if (ast_test_flag(&conference_bridge_user->flags, OPTION_MARKEDUSER)) {
+ if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MARKEDUSER)) {
conference_bridge->markedusers--;
}
@@ -462,7 +433,7 @@
/* If there are still users in the conference bridge we may need to do things (such as start MOH on them) */
if (conference_bridge->users) {
- if (ast_test_flag(&conference_bridge_user->flags, OPTION_MARKEDUSER) && !conference_bridge->markedusers) {
+ if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MARKEDUSER) && !conference_bridge->markedusers) {
struct conference_bridge_user *other_participant = NULL;
/* Start out with muting everyone */
@@ -471,7 +442,7 @@
}
/* Play back the audio prompt saying the leader has left the conference */
- if (!ast_test_flag(&conference_bridge_user->flags, OPTION_QUIET)) {
+ if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_QUIET)) {
ao2_unlock(conference_bridge);
ast_autoservice_start(conference_bridge_user->chan);
play_sound_file(conference_bridge, "conf-leaderhasleft");
@@ -481,7 +452,7 @@
/* Now on to starting MOH if needed */
AST_LIST_TRAVERSE(&conference_bridge->users_list, other_participant, list) {
- if (ast_test_flag(&other_participant->flags, OPTION_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, other_participant->chan)) {
+ if (ast_test_flag(&other_participant->u_profile, OPTION_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, other_participant->chan)) {
ast_moh_start(other_participant->chan, other_participant->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
ast_bridge_unsuspend(conference_bridge->bridge, other_participant->chan);
}
@@ -490,7 +461,7 @@
/* Of course if there is one other person in here we may need to start up MOH on them */
struct conference_bridge_user *first_participant = AST_LIST_FIRST(&conference_bridge->users_list);
- if (ast_test_flag(&first_participant->flags, OPTION_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, first_participant->chan)) {
+ if (ast_test_flag(&first_participant->u_profile, USER_OPT_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, first_participant->chan)) {
ast_moh_start(first_participant->chan, first_participant->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
ast_bridge_unsuspend(conference_bridge->bridge, first_participant->chan);
}
@@ -567,100 +538,14 @@
return 0;
}
-/*!
- * \brief DTMF Menu Callback
- *
- * \param bridge Bridge this is involving
- * \param bridge_channel Bridged channel this is involving
- * \param hook_pvt User's conference bridge structure
- *
- * \retval 0 success
- * \retval -1 failure
- */
-static int menu_callback(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
-{
- struct conference_bridge_user *conference_bridge_user = hook_pvt;
- struct conference_bridge *conference_bridge = conference_bridge_user->conference_bridge;
- int digit, res = 0, isadmin = ast_test_flag(&conference_bridge_user->flags, OPTION_ADMIN);
-
- /* See if music on hold is playing */
- ao2_lock(conference_bridge);
- if (conference_bridge->users == 1 && ast_test_flag(&conference_bridge_user->flags, OPTION_MUSICONHOLD)) {
- /* Just us so MOH is probably indeed going, let's stop it */
- ast_moh_stop(bridge_channel->chan);
- }
- ao2_unlock(conference_bridge);
-
- /* Try to play back the user menu, if it fails pass this back up so the bridging core will act on it */
- if (ast_streamfile(bridge_channel->chan, (isadmin ? "conf-adminmenu" : "conf-usermenu"), bridge_channel->chan->language)) {
- res = -1;
- goto finished;
- }
-
- /* Wait for them to enter a digit from the user menu options */
- digit = ast_waitstream(bridge_channel->chan, AST_DIGIT_ANY);
- ast_stopstream(bridge_channel->chan);
-
- if (digit == '1') {
- /* 1 - Mute or unmute yourself, note we only allow manipulation if they aren't waiting for a marked user or if marked users exist */
- if (!ast_test_flag(&conference_bridge_user->flags, OPTION_WAITMARKED) || conference_bridge->markedusers) {
- conference_bridge_user->features.mute = (!conference_bridge_user->features.mute ? 1 : 0);
- }
- res = ast_stream_and_wait(bridge_channel->chan, (conference_bridge_user->features.mute ? "conf-muted" : "conf-unmuted"), "");
- } else if (isadmin && digit == '2') {
- /* 2 - Unlock or lock conference */
- conference_bridge->locked = (!conference_bridge->locked ? 1 : 0);
- res = ast_stream_and_wait(bridge_channel->chan, (conference_bridge->locked ? "conf-lockednow" : "conf-unlockednow"), "");
- } else if (isadmin && digit == '3') {
- /* 3 - Eject last user */
- struct conference_bridge_user *last_participant = NULL;
-
- ao2_lock(conference_bridge);
- if (((last_participant = AST_LIST_LAST(&conference_bridge->users_list)) == conference_bridge_user) || (ast_test_flag(&last_participant->flags, OPTION_ADMIN))) {
- ao2_unlock(conference_bridge);
- res = ast_stream_and_wait(bridge_channel->chan, "conf-errormenu", "");
- } else {
- last_participant->kicked = 1;
- ast_bridge_remove(conference_bridge->bridge, last_participant->chan);
- ao2_unlock(conference_bridge);
- }
- } else if (digit == '4') {
- /* 4 - Decrease listening volume */
- ast_audiohook_volume_adjust(conference_bridge_user->chan, AST_AUDIOHOOK_DIRECTION_WRITE, -1);
- } else if (digit == '6') {
- /* 6 - Increase listening volume */
- ast_audiohook_volume_adjust(conference_bridge_user->chan, AST_AUDIOHOOK_DIRECTION_WRITE, 1);
- } else if (digit == '7') {
- /* 7 - Decrease talking volume */
- ast_audiohook_volume_adjust(conference_bridge_user->chan, AST_AUDIOHOOK_DIRECTION_READ, -1);
- } else if (digit == '8') {
- /* 8 - Exit the IVR */
- } else if (digit == '9') {
- /* 9 - Increase talking volume */
- ast_audiohook_volume_adjust(conference_bridge_user->chan, AST_AUDIOHOOK_DIRECTION_READ, 1);
- } else {
- /* No valid option was selected */
- res = ast_stream_and_wait(bridge_channel->chan, "conf-errormenu", "");
- }
-
- finished:
- /* See if music on hold needs to be started back up again */
- ao2_lock(conference_bridge);
- if (conference_bridge->users == 1 && ast_test_flag(&conference_bridge_user->flags, OPTION_MUSICONHOLD)) {
- ast_moh_start(bridge_channel->chan, conference_bridge_user->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
- }
- ao2_unlock(conference_bridge);
-
- bridge_channel->state = AST_BRIDGE_CHANNEL_STATE_WAIT;
-
- return res;
-}
-
/*! \brief The ConfBridge application */
static int confbridge_exec(struct ast_channel *chan, const char *data)
{
int res = 0, volume_adjustments[2];
char *parse;
+ const char *b_profile_name = "default_bridge";
+ const char *u_profile_name = "default_user";
+ const char *menu_name = "default_menu";
struct conference_bridge *conference_bridge = NULL;
struct conference_bridge_user conference_bridge_user = {
.chan = chan,
@@ -668,7 +553,9 @@
const char *tmp, *join_sound = NULL, *leave_sound = NULL;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(conf_name);
- AST_APP_ARG(options);
+ AST_APP_ARG(b_profile_name);
+ AST_APP_ARG(u_profile_name);
+ AST_APP_ARG(menu_name);
);
if (ast_strlen_zero(data)) {
@@ -681,9 +568,21 @@
AST_STANDARD_APP_ARGS(args, parse);
- if (args.argc == 2) {
- ast_app_parse_options(app_opts, &conference_bridge_user.flags, conference_bridge_user.opt_args, args.options);
- }
+ /* bridge profile name */
+ if (args.argc > 1 && !ast_strlen_zero(args.b_profile_name)) {
+ b_profile_name = args.b_profile_name;
+ }
+ conf_find_bridge_profile(b_profile_name, &conference_bridge_user.b_profile);
+ /* user profile name */
+ if (args.argc > 2 && !ast_strlen_zero(args.u_profile_name)) {
+ u_profile_name = args.u_profile_name;
+ }
+ conf_find_user_profile(u_profile_name, &conference_bridge_user.u_profile);
+ /* menu name */
+ if (args.argc > 3 && !ast_strlen_zero(args.menu_name)) {
+ menu_name = args.menu_name;
+ }
+ conf_find_menu(menu_name, &conference_bridge_user.dtmf_menu);
/* Look for a conference bridge matching the provided name */
if (!(conference_bridge = join_conference_bridge(args.conf_name, &conference_bridge_user))) {
@@ -698,12 +597,13 @@
ast_bridge_features_init(&conference_bridge_user.features);
/* If the menu option is enabled provide a user or admin menu as a custom feature hook */
- if (ast_test_flag(&conference_bridge_user.flags, OPTION_MENU)) {
- ast_bridge_features_hook(&conference_bridge_user.features, "#", menu_callback, &conference_bridge_user);
- }
+//todohere once the custom menu is created, add the hooks here
+// if (ast_test_flag(&conference_bridge_user.flags, OPTION_MENU)) {
+// ast_bridge_features_hook(&conference_bridge_user.features, "#", menu_callback, &conference_bridge_user);
+// }
/* If the caller should be joined already muted, make it so */
- if (ast_test_flag(&conference_bridge_user.flags, OPTION_STARTMUTED)) {
+ if (ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_STARTMUTED)) {
conference_bridge_user.features.mute = 1;
}
@@ -718,7 +618,7 @@
ast_channel_unlock(chan);
/* If there is 1 or more people already in the conference then play our join sound unless overridden */
- if (!ast_test_flag(&conference_bridge_user.flags, OPTION_QUIET) && !ast_strlen_zero(join_sound) && conference_bridge->users >= 2) {
+ if (!ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_QUIET) && !ast_strlen_zero(join_sound) && conference_bridge->users >= 2) {
ast_autoservice_start(chan);
play_sound_file(conference_bridge, join_sound);
ast_autoservice_stop(chan);
@@ -728,7 +628,7 @@
ast_bridge_join(conference_bridge->bridge, chan, NULL, &conference_bridge_user.features);
/* If there is 1 or more people (not including us) already in the conference then play our leave sound unless overridden */
- if (!ast_test_flag(&conference_bridge_user.flags, OPTION_QUIET) && !ast_strlen_zero(leave_sound) && conference_bridge->users >= 2) {
+ if (!ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_QUIET) && !ast_strlen_zero(leave_sound) && conference_bridge->users >= 2) {
ast_autoservice_start(chan);
play_sound_file(conference_bridge, leave_sound);
ast_autoservice_stop(chan);
@@ -742,7 +642,7 @@
ast_bridge_features_cleanup(&conference_bridge_user.features);
/* If the user was kicked from the conference play back the audio prompt for it */
- if (!ast_test_flag(&conference_bridge_user.flags, OPTION_QUIET) && conference_bridge_user.kicked) {
+ if (!ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_QUIET) && conference_bridge_user.kicked) {
res = ast_stream_and_wait(chan, "conf-kicked", "");
}
Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=309299&r1=309298&r2=309299
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Wed Mar 2 14:49:57 2011
@@ -134,22 +134,10 @@
ast_log(LOG_WARNING, "internal_sample_rate '%s' at line %d of %s is not supported.\n",
var->value, var->lineno, CONF_CONFIG);
}
- } else if (!strcasecmp(var->name, "music_on_hold_when_empty")) {
- b_profile->flags = ast_true(var->value) ?
- b_profile->flags | BRIDGE_OPT_MUSICONHOLD :
- b_profile->flags & ~BRIDGE_OPT_MUSICONHOLD;
} else if (!strcasecmp(var->name, "wait_marked")) {
b_profile->flags = ast_true(var->value) ?
b_profile->flags | BRIDGE_OPT_WAITMARKED :
b_profile->flags & ~BRIDGE_OPT_WAITMARKED;
- } else if (!strcasecmp(var->name, "quiet")) {
- b_profile->flags = ast_true(var->value) ?
- b_profile->flags | BRIDGE_OPT_QUIET :
- b_profile->flags & ~BRIDGE_OPT_QUIET;
- } else if (!strcasecmp(var->name, "announce_user_count")) {
- b_profile->flags = ast_true(var->value) ?
- b_profile->flags | BRIDGE_OPT_ANNOUNCEUSERCOUNT :
- b_profile->flags & ~BRIDGE_OPT_ANNOUNCEUSERCOUNT;
} else if (!strcasecmp(var->name, "type")) {
continue;
} else {
@@ -199,6 +187,18 @@
u_profile->flags = ast_true(var->name) ?
u_profile->flags | USER_OPT_STARTMUTED :
u_profile->flags & ~USER_OPT_STARTMUTED;
+ } else if (!strcasecmp(var->name, "music_on_hold_when_empty")) {
+ u_profile->flags = ast_true(var->value) ?
+ u_profile->flags | USER_OPT_MUSICONHOLD :
+ u_profile->flags & ~USER_OPT_MUSICONHOLD;
+ } else if (!strcasecmp(var->name, "quiet")) {
+ u_profile->flags = ast_true(var->value) ?
+ u_profile->flags | USER_OPT_QUIET :
+ u_profile->flags & ~USER_OPT_QUIET;
+ } else if (!strcasecmp(var->name, "announce_user_count")) {
+ u_profile->flags = ast_true(var->value) ?
+ u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNT :
+ u_profile->flags & ~USER_OPT_ANNOUNCEUSERCOUNT;
} else {
ast_log(LOG_WARNING, "Unknown option '%s' at line %d of %s is not supported.\n",
var->name, var->lineno, CONF_CONFIG);
@@ -303,6 +303,15 @@
ast_cli(a->fd,"Start Muted: %s\n",
u_profile.flags & USER_OPT_STARTMUTED?
"true" : "false");
+ ast_cli(a->fd,"MOH When Empty: %s\n",
+ u_profile.flags & USER_OPT_MUSICONHOLD ?
+ "enabled" : "disabled");
+ ast_cli(a->fd,"Quiet: %s\n",
+ u_profile.flags & USER_OPT_QUIET ?
+ "enabled" : "disabled");
+ ast_cli(a->fd,"Announce User Count: %s\n",
+ u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNT ?
+ "enabled" : "disabled");
ast_cli(a->fd,"\n");
return CLI_SUCCESS;
@@ -364,17 +373,8 @@
snprintf(tmp, sizeof(tmp), "auto");
}
ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp);
- ast_cli(a->fd,"MOH When Empty: %s\n",
- b_profile.flags & BRIDGE_OPT_MUSICONHOLD ?
- "enabled" : "disabled");
ast_cli(a->fd,"Wait Marked: %s\n",
b_profile.flags & BRIDGE_OPT_WAITMARKED ?
- "enabled" : "disabled");
- ast_cli(a->fd,"Quiet: %s\n",
- b_profile.flags & BRIDGE_OPT_QUIET ?
- "enabled" : "disabled");
- ast_cli(a->fd,"Announce User Count: %s\n",
- b_profile.flags & BRIDGE_OPT_ANNOUNCEUSERCOUNT ?
"enabled" : "disabled");
ast_cli(a->fd,"\n");
Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=309299&r1=309298&r2=309299
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Wed Mar 2 14:49:57 2011
@@ -44,14 +44,14 @@
USER_OPT_ADMIN = (1 << 0), /*!< Set if the caller is an administrator */
USER_OPT_MARKEDUSER = (1 << 2), /*!< Set if the caller is a marked user */
USER_OPT_STARTMUTED = (1 << 3), /*!< Set if the caller should be initially set muted */
+ USER_OPT_MUSICONHOLD = (1 << 4), /*!< Set if music on hold should be played if nobody else is in the conference bridge */
+ USER_OPT_QUIET = (1 << 5), /*!< Set if no audio prompts should be played */
+ USER_OPT_ANNOUNCEUSERCOUNT = (1 << 6), /*!< Set if the number of users should be announced to the caller */
};
enum bridge_profile_flags {
- BRIDGE_OPT_MUSICONHOLD = (1 << 0), /*!< Set if music on hold should be played if nobody else is in the conference bridge */
BRIDGE_OPT_NOONLYPERSON = (1 << 1), /*!< Set if the "you are currently the only person in this conference" sound file should not be played */
BRIDGE_OPT_WAITMARKED = (1 << 2), /*!< Set if the conference must wait for a marked user before starting */
- BRIDGE_OPT_QUIET = (1 << 3), /*!< Set if no audio prompts should be played */
- BRIDGE_OPT_ANNOUNCEUSERCOUNT = (1 << 4), /*!< Set if the number of users should be announced to the caller */
};
struct conf_menu {
@@ -83,21 +83,22 @@
struct conference_bridge {
char name[MAX_CONF_NAME]; /*!< Name of the conference bridge */
struct ast_bridge *bridge; /*!< Bridge structure doing the mixing */
- const struct bridge_profile *b_profile; /*!< The Bridge Configuration Profile */
+ struct bridge_profile b_profile; /*!< The Bridge Configuration Profile */
unsigned int users; /*!< Number of users present */
unsigned int markedusers; /*!< Number of marked users present */
unsigned int locked:1; /*!< Is this conference bridge locked? */
- AST_LIST_HEAD_NOLOCK(, conference_bridge_user) users_list; /*!< List of users participating in the conference bridge */
struct ast_channel *playback_chan; /*!< Channel used for playback into the conference bridge */
ast_mutex_t playback_lock; /*!< Lock used for playback channel */
+ AST_LIST_HEAD_NOLOCK(, conference_bridge_user) users_list; /*!< List of users participating in the conference bridge */
};
/*! \brief The structure that represents a conference bridge user */
struct conference_bridge_user {
struct conference_bridge *conference_bridge; /*!< Conference bridge they are participating in */
- const struct bridge_profile *u_profile; /*!< The User Configuration Profile */
+ struct bridge_profile b_profile; /*!< The Bridge Configuration Profile */
+ struct user_profile u_profile; /*!< The User Configuration Profile */
+ struct conf_menu dtmf_menu; /*!< The User's DTMF menu */
struct ast_channel *chan; /*!< Asterisk channel participating */
- struct ast_flags flags; /*!< Flags passed in when the application was called */ //todohere this must go away
char *opt_args[OPTION_ARRAY_SIZE]; /*!< Arguments to options passed when application was called */
struct ast_bridge_features features; /*!< Bridge features structure */
unsigned int kicked:1; /*!< User has been kicked from the conference */
Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=309299&r1=309298&r2=309299
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Wed Mar 2 14:49:57 2011
@@ -11,6 +11,14 @@
;admin=yes ; Sets if the user is an admin or not. Off by default.
;marked=yes ; Sets if this is a marked user or not. Off by default.
;startmuted=yes; Sets if all users should start out muted. Off by default
+;music_on_hold_when_empty=yes ; Sets whether MOH should be played when only
+ ; one person is in the conference. Off by default.
+;quiet=yes ; Sets if no audio prompts should be played. Off by default
+;announce_user_count=yes ; Sets if the number of users should be announced to the
+ ; caller. Off by default.
+
+
+
[default_bridge]
type=bridge
@@ -22,14 +30,8 @@
; closest sample rate Asterisk does support to the one requested
; will be used.
-;music_on_hold_when_empty=yes ; Sets whether MOH should be played when only
- ; one person is in the conference. Off by default.
;wait_marked=yes ; Sets if the conference must wait for a marked user
; to enter before starting. Off by default.
-;quiet=yes ; Sets if no audio prompts should be played. Off by default
-;announce_user_count=yes ; Sets if the number of users should be announced to the
- ; caller. Off by default.
-
[default_menu]
type=menu
More information about the asterisk-commits
mailing list