From 27867e65d038e244d7dee68cc94eba47286506d5 Mon Sep 17 00:00:00 2001 From: "Michael L. Young" Date: Tue, 12 Feb 2013 03:31:46 +0000 Subject: Adding Some More Manager Events To ConfBridge Currently, ConfBridge does not send manager events for ConfbridgeMute, ConfbridgeUnmute, ConfbridgeStartRecord and ConfbridgeStopRecord. This patch adds these events to the manager. The reporter's patch moves some other events up to the beginning of the file. The patch being committed is based on the patch contributed from the reporter of this issue. I have made a lot of modifications to the patch in order for it to fit in better with what we currently are doing in the code when it comes to manager events. I also made a few changes to the elements on some of the events. (closes issue ASTERISK-20827) Reported by: Clint Davis Tested by: Clint Davis, Michael L. Young Patches: 20827.diff uploaded by Clint Davis (license 6453) asterisk-20827-confbridge-events.diff uploaded by Michael L. Young (license 5026) Review: https://reviewboard.asterisk.org/r/2309/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381256 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_confbridge.c | 277 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 187 insertions(+), 90 deletions(-) diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 37bc4a321..1261a8da3 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -379,6 +379,186 @@ const char *conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds return ""; } +static void send_conf_start_event(const char *conf_name) +{ + /*** DOCUMENTATION + + Raised when a conference starts. + + + The name of the Confbridge conference. + + + + ConfbridgeEnd + ConfBridge + + + ***/ + manager_event(EVENT_FLAG_CALL, "ConfbridgeStart", "Conference: %s\r\n", conf_name); +} + +static void send_conf_end_event(const char *conf_name) +{ + /*** DOCUMENTATION + + Raised when a conference ends. + + + + + ConfbridgeStart + + + ***/ + manager_event(EVENT_FLAG_CALL, "ConfbridgeEnd", "Conference: %s\r\n", conf_name); +} + +static void send_join_event(struct ast_channel *chan, const char *conf_name) +{ + /*** DOCUMENTATION + + Raised when a channel joins a Confbridge conference. + + + + + ConfbridgeLeave + ConfBridge + + + ***/ + ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeJoin", + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Conference: %s\r\n" + "CallerIDnum: %s\r\n" + "CallerIDname: %s\r\n", + ast_channel_name(chan), + ast_channel_uniqueid(chan), + conf_name, + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") + ); +} + +static void send_leave_event(struct ast_channel *chan, const char *conf_name) +{ + /*** DOCUMENTATION + + Raised when a channel leaves a Confbridge conference. + + + + + ConfbridgeJoin + + + ***/ + ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeLeave", + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Conference: %s\r\n" + "CallerIDnum: %s\r\n" + "CallerIDname: %s\r\n", + ast_channel_name(chan), + ast_channel_uniqueid(chan), + conf_name, + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") + ); +} + +static void send_start_record_event(const char *conf_name) +{ + /*** DOCUMENTATION + + Raised when a conference recording starts. + + + + + ConfbridgeStopRecord + ConfBridge + + + ***/ + + manager_event(EVENT_FLAG_CALL, "ConfbridgeStartRecord", "Conference: %s\r\n", conf_name); +} + +static void send_stop_record_event(const char *conf_name) +{ + /*** DOCUMENTATION + + Raised when a conference recording stops. + + + + + ConfbridgeStartRecord + + + ***/ + manager_event(EVENT_FLAG_CALL, "ConfbridgeStopRecord", "Conference: %s\r\n", conf_name); +} + +static void send_mute_event(struct ast_channel *chan, const char *conf_name) +{ + /*** DOCUMENTATION + + Raised when a Confbridge participant mutes. + + + + + ConfbridgeUnmute + ConfBridge + + + ***/ + ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeMute", + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Conference: %s\r\n" + "CallerIDnum: %s\r\n" + "CallerIDname: %s\r\n", + ast_channel_name(chan), + ast_channel_uniqueid(chan), + conf_name, + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") + ); +} + +static void send_unmute_event(struct ast_channel *chan, const char *conf_name) +{ + /*** DOCUMENTATION + + Raised when a Confbridge participant unmutes. + + + + + ConfbridgeMute + + + ***/ + ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeUnmute", + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Conference: %s\r\n" + "CallerIDnum: %s\r\n" + "CallerIDname: %s\r\n", + ast_channel_name(chan), + ast_channel_uniqueid(chan), + conf_name, + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") + ); +} + + static struct ast_frame *rec_read(struct ast_channel *ast) { return &ast_null_frame; @@ -486,6 +666,7 @@ static int conf_stop_record(struct conference_bridge *conference_bridge) ast_queue_frame(chan, &ast_null_frame); chan = ast_channel_unref(chan); ast_test_suite_event_notify("CONF_STOP_RECORD", "Message: stopped conference recording channel\r\nConference: %s", conference_bridge->b_profile.name); + send_stop_record_event(conference_bridge->name); return 0; } @@ -559,6 +740,7 @@ static int conf_start_record(struct conference_bridge *conference_bridge) ast_cond_signal(&conference_bridge->record_cond); ast_mutex_unlock(&conference_bridge->record_lock); ast_test_suite_event_notify("CONF_START_RECORD", "Message: started conference recording channel\r\nConference: %s", conference_bridge->b_profile.name); + send_start_record_event(conference_bridge->name); return 0; } @@ -584,96 +766,6 @@ static int start_conf_record_thread(struct conference_bridge *conference_bridge) return 0; } -static void send_conf_start_event(const char *conf_name) -{ - /*** DOCUMENTATION - - Raised when a conference starts. - - - The name of the Confbridge conference. - - - - ConfbridgeEnd - - - ***/ - manager_event(EVENT_FLAG_CALL, "ConfbridgeStart", "Conference: %s\r\n", conf_name); -} - -static void send_conf_end_event(const char *conf_name) -{ - /*** DOCUMENTATION - - Raised when a conference ends. - - - - - ConfbridgeStart - ConfBridge - - - ***/ - manager_event(EVENT_FLAG_CALL, "ConfbridgeEnd", "Conference: %s\r\n", conf_name); -} - -static void send_join_event(struct ast_channel *chan, const char *conf_name) -{ - /*** DOCUMENTATION - - Raised when a channel joins a Confbridge conference. - - - - - ConfbridgeLeave - ConfBridge - - - ***/ - ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeJoin", - "Channel: %s\r\n" - "Uniqueid: %s\r\n" - "Conference: %s\r\n" - "CallerIDnum: %s\r\n" - "CallerIDname: %s\r\n", - ast_channel_name(chan), - ast_channel_uniqueid(chan), - conf_name, - S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), - S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") - ); -} - -static void send_leave_event(struct ast_channel *chan, const char *conf_name) -{ - /*** DOCUMENTATION - - Raised when a channel leaves a Confbridge conference. - - - - - ConfbridgeJoin - - - ***/ - ast_manager_event(chan, EVENT_FLAG_CALL, "ConfbridgeLeave", - "Channel: %s\r\n" - "Uniqueid: %s\r\n" - "Conference: %s\r\n" - "CallerIDnum: %s\r\n" - "CallerIDname: %s\r\n", - ast_channel_name(chan), - ast_channel_uniqueid(chan), - conf_name, - S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), - S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") - ); -} - /*! * \internal * \brief Complain if the given sound file does not exist. @@ -1735,6 +1827,11 @@ static int action_toggle_mute(struct conference_bridge *conference_bridge, if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_WAITMARKED) || conference_bridge->markedusers) { conference_bridge_user->features.mute = (!conference_bridge_user->features.mute ? 1 : 0); ast_test_suite_event_notify("CONF_MUTE", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", ast_channel_name(chan), conference_bridge_user->features.mute ? "muted" : "unmuted", conference_bridge_user->b_profile.name, ast_channel_name(chan)); + if (conference_bridge_user->features.mute) { + send_mute_event(chan, conference_bridge->name); + } else { + send_unmute_event(chan, conference_bridge->name); + } } return ast_stream_and_wait(chan, (conference_bridge_user->features.mute ? conf_get_sound(CONF_SOUND_MUTED, conference_bridge_user->b_profile.sounds) : -- cgit v1.2.3