[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311470 - in /team/dvossel/hd_confbridg...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 21 10:07:34 CDT 2011
Author: dvossel
Date: Mon Mar 21 10:07:29 2011
New Revision: 311470
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311470
Log:
Addition of options for all the available customizable sounds for a conference
Modified:
team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
team/dvossel/hd_confbridge/configs/confbridge.conf.sample
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=311470&r1=311469&r2=311470
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Mon Mar 21 10:07:29 2011
@@ -152,6 +152,63 @@
if (!strcasecmp(sound_name, "sound_onlyperson")) {
ast_string_field_set(sounds, onlyperson, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_has_joined")) {
+ ast_string_field_set(sounds, hasjoin, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_has_left")) {
+ ast_string_field_set(sounds, hasleft, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_kicked")) {
+ ast_string_field_set(sounds, kicked, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_muted")) {
+ ast_string_field_set(sounds, muted, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_unmuted")) {
+ ast_string_field_set(sounds, unmuted, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_there_are")) {
+ ast_string_field_set(sounds, thereare, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_other_in_party")) {
+ ast_string_field_set(sounds, otherinparty, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_place_into_conference")) {
+ ast_string_field_set(sounds, placeintoconf, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_wait_for_leader")) {
+ ast_string_field_set(sounds, waitforleader, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_get_pin")) {
+ ast_string_field_set(sounds, getpin, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_invalid_pin")) {
+ ast_string_field_set(sounds, invalidpin, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_locked")) {
+ ast_string_field_set(sounds, locked, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_unlocked_now")) {
+ ast_string_field_set(sounds, unlockednow, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_locked_now")) {
+ ast_string_field_set(sounds, lockednow, sound_file);
+ } else if (!strcasecmp(sound_name, "sound_error_menu")) {
+ ast_string_field_set(sounds, errormenu, sound_file);
+ } else {
+ return -1;
+ }
+
+ return 0;
+}
+
+static int set_bridge_option(const char *name, const char *value, struct bridge_profile *b_profile)
+{
+ if (!strcasecmp(name, "internal_sample_rate")) {
+ if (!strcasecmp(value, "auto")) {
+ b_profile->internal_sample_rate = 0;
+ } else if (sscanf(value, "%30u", &b_profile->internal_sample_rate) != 1) {
+ return -1;
+ }
+ } else if (!strcasecmp(name, "record_conference")) {
+ b_profile->flags = ast_true(value) ?
+ b_profile->flags | BRIDGE_OPT_RECORD_CONFERENCE :
+ b_profile->flags & ~BRIDGE_OPT_RECORD_CONFERENCE;
+ } else if (!strcasecmp(name, "max_members")) {
+ if (sscanf(value, "%30u", &b_profile->max_members) != 1) {
+ return -1;
+ }
+ } else if (strlen(name) >= 5 && !strncasecmp(name, "sound", 5)) {
+ if (set_sound(name, value, b_profile->sounds)) {
+ return -1;
+ }
} else {
return -1;
}
@@ -196,35 +253,82 @@
for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
if (!strcasecmp(var->name, "type")) {
continue;
- } else if (!strcasecmp(var->name, "internal_sample_rate")) {
- if (!strcasecmp(var->value, "auto")) {
- b_profile->internal_sample_rate = 0;
- } else if (sscanf(var->value, "%30u", &b_profile->internal_sample_rate) != 1) {
- 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, "record_conference")) {
- b_profile->flags = ast_true(var->value) ?
- b_profile->flags | BRIDGE_OPT_RECORD_CONFERENCE :
- b_profile->flags & ~BRIDGE_OPT_RECORD_CONFERENCE;
- } else if (!strcasecmp(var->name, "max_members")) {
- if (sscanf(var->value, "%30u", &b_profile->max_members) != 1) {
- ast_log(LOG_WARNING, "max_members '%s' at line %d of %s is not supported.\n",
- var->value, var->lineno, CONF_CONFIG);
- }
- } else if (strlen(var->name) >= 5 && !strncasecmp(var->name, "sound", 8)) {
- if (set_sound(var->name, var->value, b_profile->sounds)) {
- ast_log(LOG_WARNING, "'%s' at line %d of %s is not supported.\n",
- var->value, var->lineno, CONF_CONFIG);
- }
- } else {
- ast_log(LOG_WARNING, "Unknown option '%s' at line %d of %s is not supported.\n",
+ } else if (set_bridge_option(var->name, var->value, b_profile)) {
+ ast_log(LOG_WARNING, "Invalid: '%s' at line %d of %s is not supported.\n",
var->name, var->lineno, CONF_CONFIG);
}
}
ao2_unlock(b_profile);
ao2_ref(b_profile, -1);
+ return 0;
+}
+
+static int set_user_option(const char *name, const char *value, struct user_profile *u_profile)
+{
+ if (!strcasecmp(name, "admin")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_ADMIN :
+ u_profile->flags & ~USER_OPT_ADMIN;
+ } else if (!strcasecmp(name, "marked")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_MARKEDUSER :
+ u_profile->flags & ~USER_OPT_MARKEDUSER;
+ } else if (!strcasecmp(name, "startmuted")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_STARTMUTED :
+ u_profile->flags & ~USER_OPT_STARTMUTED;
+ } else if (!strcasecmp(name, "music_on_hold_when_empty")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_MUSICONHOLD :
+ u_profile->flags & ~USER_OPT_MUSICONHOLD;
+ } else if (!strcasecmp(name, "quiet")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_QUIET :
+ u_profile->flags & ~USER_OPT_QUIET;
+ } else if (!strcasecmp(name, "announce_user_count")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNT :
+ u_profile->flags & ~USER_OPT_ANNOUNCEUSERCOUNT;
+ } else if (!strcasecmp(name, "announce_only_user")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags & ~USER_OPT_NOONLYPERSON :
+ u_profile->flags | USER_OPT_NOONLYPERSON;
+ } else if (!strcasecmp(name, "wait_marked")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_WAITMARKED :
+ u_profile->flags & ~USER_OPT_WAITMARKED;
+ } else if (!strcasecmp(name, "end_marked")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_ENDMARKED :
+ u_profile->flags & ~USER_OPT_ENDMARKED;
+ } else if (!strcasecmp(name, "talk_detection_events")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_TALKER_DETECT :
+ u_profile->flags & ~USER_OPT_TALKER_DETECT;
+ } else if (!strcasecmp(name, "dtmf_passthrough")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_DTMF_PASS:
+ u_profile->flags & ~USER_OPT_DTMF_PASS;
+ } else if (!strcasecmp(name, "announce_join_leave")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_ANNOUNCE_JOIN_LEAVE :
+ u_profile->flags & ~USER_OPT_ANNOUNCE_JOIN_LEAVE;
+ } else if (!strcasecmp(name, "pin")) {
+ ast_copy_string(u_profile->pin, value, sizeof(u_profile->pin));
+ } else if (!strcasecmp(name, "music_on_hold_class")) {
+ ast_copy_string(u_profile->moh_class, value, sizeof(u_profile->moh_class));
+ } else if (!strcasecmp(name, "denoise")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_DENOISE :
+ u_profile->flags & ~USER_OPT_DENOISE;
+ } else if (!strcasecmp(name, "drop_silence")) {
+ u_profile->flags = ast_true(value) ?
+ u_profile->flags | USER_OPT_DROP_SILENCE :
+ u_profile->flags & ~USER_OPT_DROP_SILENCE;
+ } else {
+ return -1;
+ }
return 0;
}
@@ -252,68 +356,8 @@
for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
if (!strcasecmp(var->name, "type")) {
continue;
- } else if (!strcasecmp(var->name, "admin")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_ADMIN :
- u_profile->flags & ~USER_OPT_ADMIN;
- } else if (!strcasecmp(var->name, "marked")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_MARKEDUSER :
- u_profile->flags & ~USER_OPT_MARKEDUSER;
- } else if (!strcasecmp(var->name, "startmuted")) {
- u_profile->flags = ast_true(var->value) ?
- 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 if (!strcasecmp(var->name, "announce_only_user")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags & ~USER_OPT_NOONLYPERSON :
- u_profile->flags | USER_OPT_NOONLYPERSON;
- } else if (!strcasecmp(var->name, "wait_marked")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_WAITMARKED :
- u_profile->flags & ~USER_OPT_WAITMARKED;
- } else if (!strcasecmp(var->name, "end_marked")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_ENDMARKED :
- u_profile->flags & ~USER_OPT_ENDMARKED;
- } else if (!strcasecmp(var->name, "talk_detection_events")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_TALKER_DETECT :
- u_profile->flags & ~USER_OPT_TALKER_DETECT;
- } else if (!strcasecmp(var->name, "dtmf_passthrough")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_DTMF_PASS:
- u_profile->flags & ~USER_OPT_DTMF_PASS;
- } else if (!strcasecmp(var->name, "announce_join_leave")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_ANNOUNCE_JOIN_LEAVE :
- u_profile->flags & ~USER_OPT_ANNOUNCE_JOIN_LEAVE;
- } else if (!strcasecmp(var->name, "pin")) {
- ast_copy_string(u_profile->pin, var->value, sizeof(u_profile->pin));
- } else if (!strcasecmp(var->name, "music_on_hold_class")) {
- ast_copy_string(u_profile->moh_class, var->value, sizeof(u_profile->moh_class));
- } else if (!strcasecmp(var->name, "denoise")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_DENOISE :
- u_profile->flags & ~USER_OPT_DENOISE;
- } else if (!strcasecmp(var->name, "drop_silence")) {
- u_profile->flags = ast_true(var->value) ?
- u_profile->flags | USER_OPT_DROP_SILENCE :
- u_profile->flags & ~USER_OPT_DROP_SILENCE;
- } else {
- ast_log(LOG_WARNING, "Unknown option '%s' at line %d of %s is not supported.\n",
+ } else if (set_user_option(var->name, var->value, u_profile)) {
+ ast_log(LOG_WARNING, "Invalid option '%s' at line %d of %s is not supported.\n",
var->name, var->lineno, CONF_CONFIG);
}
}
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=311470&r1=311469&r2=311470
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Mon Mar 21 10:07:29 2011
@@ -82,6 +82,41 @@
; closest sample rate Asterisk does support to the one requested
; will be used.
+; All sounds in the conference are customizable using the bridge profile options below.
+; Simply state the option followed by the filename or full path of the filename after
+; the option. Example: sound_had_joined=conf-hasjoin This will play the conf-hasjoin
+; sound file found in the sounds directory when announcing someone's name is joining the
+; conference.
+
+;sound_has_joined ; The sound played before announcing someone's name has
+ ; joined the conference. This is used for user intros.
+ ; Example "_____ has joined the conference"
+;sound_has_left ; The sound played when announcing someone's name has
+ ; left the conference. This is used for user intros.
+ ; Example "_____ has left the conference"
+;sound_kicked ; The sound played to a user who has been kicked from the conference.
+;sound_muted ; The sound played when the mute option it toggled on.
+;sound_unmuted ; The sound played when the mute option it toggled off.
+;sound_only_person ; The sound played when the user is the only person in the conference.
+;sound_only_one ; The sound played to a user when there is only one other
+ ; person is in the conference.
+;sound_there_are ; The sound played when announcing how many users there
+ ; are in a conference.
+;sound_other_in_party; ; This file is used in conjunction with 'sound_there_are"
+ ; when announcing how many users there are in the conference.
+ ; The sounds are stringed together like this.
+ ; "sound_there_are" <number of participants> "sound_other_in_party"
+;sound_place_into_conference ; The sound played when someone is placed into the conference
+ ; after waiting for a marked user.
+;sound_wait_for_leader ; The sound played when a user is placed into a conference that
+ ; can not start until a marked user enters.
+;sound_leader_has_left ; The sound played when the last marked user leaves the conference.
+;sound_get_pin ; The sound played when prompting for a conference pin number.
+;sound_invalid_pin ; The sound played when an invalid pin is entered too many times.
+;sound_locked ; The sound played to a user trying to join a locked conference.
+;sound_locked_now ; The sound played to an admin after toggling the conference to locked mode.
+;sound_unlocked_now; The sound played to an admin after toggling the conference to unlocked mode.
+;sound_error_menu ; The sound played when an invalid menu option is entered.
; --- ConfBridge Menu Options ---
; The ConfBridge application also has the ability to
More information about the asterisk-commits
mailing list