fire auto gain level events

This commit is contained in:
Anthony Minessale 2011-02-25 18:25:17 -06:00
parent e3eec389b0
commit d8ef36edca
1 changed files with 16 additions and 2 deletions

View File

@ -195,7 +195,8 @@ typedef enum {
EFLAG_BGDIAL_RESULT = (1 << 24),
EFLAG_FLOOR_CHANGE = (1 << 25),
EFLAG_MUTE_DETECT = (1 << 26),
EFLAG_RECORD = (1 << 27)
EFLAG_RECORD = (1 << 27),
EFLAG_AUTO_GAIN_LEVEL = (1 << 28)
} event_type_t;
typedef struct conference_file_node {
@ -2049,7 +2050,7 @@ static void clear_avg(conference_member_t *member)
static void check_agc_levels(conference_member_t *member)
{
int x = 0;
int x = 0, y = member->agc_volume_in_level;
if (!member->avg_score) return;
@ -2064,6 +2065,8 @@ static void check_agc_levels(conference_member_t *member)
}
if (x) {
switch_event_t *event;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG7,
"AGC %s:%d diff:%d level:%d cur:%d avg:%d vol:%d %s\n",
member->conference->name,
@ -2071,6 +2074,17 @@ static void check_agc_levels(conference_member_t *member)
member->score, member->avg_score, member->agc_volume_in_level, x > 0 ? "+++" : "---");
clear_avg(member);
if (test_eflag(member->conference, EFLAG_AUTO_GAIN_LEVEL) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_member_data(member, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "auto-gain-level");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Level", "%d", y);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->agc_volume_in_level);
switch_event_fire(&event);
}
}
}