[asterisk-commits] kmoore: branch kmoore/hidden_channels r392392 - in /team/kmoore/hidden_channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 20 20:29:50 CDT 2013


Author: kmoore
Date: Thu Jun 20 20:29:48 2013
New Revision: 392392

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392392
Log:
Commit work up to this point

Modified:
    team/kmoore/hidden_channels/apps/confbridge/conf_chan_announce.c
    team/kmoore/hidden_channels/apps/confbridge/conf_chan_record.c
    team/kmoore/hidden_channels/apps/confbridge/confbridge_manager.c
    team/kmoore/hidden_channels/include/asterisk/channel.h
    team/kmoore/hidden_channels/include/asterisk/stasis_channels.h
    team/kmoore/hidden_channels/main/cdr.c
    team/kmoore/hidden_channels/main/cel.c
    team/kmoore/hidden_channels/main/manager_bridging.c
    team/kmoore/hidden_channels/main/manager_channels.c
    team/kmoore/hidden_channels/main/stasis_channels.c
    team/kmoore/hidden_channels/res/parking/parking_manager.c

Modified: team/kmoore/hidden_channels/apps/confbridge/conf_chan_announce.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/apps/confbridge/conf_chan_announce.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/apps/confbridge/conf_chan_announce.c (original)
+++ team/kmoore/hidden_channels/apps/confbridge/conf_chan_announce.c Thu Jun 20 20:29:48 2013
@@ -113,6 +113,11 @@
 	}
 
 	return chan;
+}
+
+static int announce_hidden(struct ast_channel *chan)
+{
+	return 1;
 }
 
 static struct ast_channel_tech announce_tech = {
@@ -134,6 +139,7 @@
 	.send_text = ast_unreal_sendtext,
 	.queryoption = ast_unreal_queryoption,
 	.setoption = ast_unreal_setoption,
+	.hidden = announce_hidden,
 };
 
 struct ast_channel_tech *conf_announce_get_tech(void)

Modified: team/kmoore/hidden_channels/apps/confbridge/conf_chan_record.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/apps/confbridge/conf_chan_record.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/apps/confbridge/conf_chan_record.c (original)
+++ team/kmoore/hidden_channels/apps/confbridge/conf_chan_record.c Thu Jun 20 20:29:48 2013
@@ -79,6 +79,11 @@
 	return chan;
 }
 
+static int rec_hidden(struct ast_channel *chan)
+{
+	return 1;
+}
+
 static struct ast_channel_tech record_tech = {
 	.type = "CBRec",
 	.description = "Conference Bridge Recording Channel",
@@ -86,6 +91,7 @@
 	.call = rec_call,
 	.read = rec_read,
 	.write = rec_write,
+	.hidden = rec_hidden,
 };
 
 struct ast_channel_tech *conf_record_get_tech(void)

Modified: team/kmoore/hidden_channels/apps/confbridge/confbridge_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/apps/confbridge/confbridge_manager.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/apps/confbridge/confbridge_manager.c (original)
+++ team/kmoore/hidden_channels/apps/confbridge/confbridge_manager.c Thu Jun 20 20:29:48 2013
@@ -195,13 +195,16 @@
 {
 	struct ast_bridge_blob *blob = stasis_message_data(message);
 	const char *conference_name;
-	RAII_VAR(struct ast_str *, bridge_text,
-		ast_manager_build_bridge_state_string(blob->bridge, ""),
-		ast_free);
+	RAII_VAR(struct ast_str *, bridge_text, NULL, ast_free);
 	RAII_VAR(struct ast_str *, channel_text, NULL, ast_free);
 
 	ast_assert(blob != NULL);
 	ast_assert(event != NULL);
+
+	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
+	if (!bridge_text) {
+		return;
+	}
 
 	conference_name = ast_json_string_get(ast_json_object_get(blob->blob, "conference"));
 	ast_assert(conference_name != NULL);

Modified: team/kmoore/hidden_channels/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/include/asterisk/channel.h?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/include/asterisk/channel.h (original)
+++ team/kmoore/hidden_channels/include/asterisk/channel.h Thu Jun 20 20:29:48 2013
@@ -737,6 +737,17 @@
 	 * \retval -1 on error.
 	 */
 	int (*pre_call)(struct ast_channel *chan, const char *sub_args);
+
+	/*!
+	 * \brief Determine whether a channel should be hidden from external entities.
+	 * \since 12.0
+	 *
+	 * \param chan Channel to check.
+	 *
+	 * \retval non-zero if the channel should be hidden.
+	 * \retval zero if the channel should not be hidden.
+	 */
+	int (*hidden)(struct ast_channel *chan);
 };
 
 /*! Kill the channel channel driver technology descriptor. */

Modified: team/kmoore/hidden_channels/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/include/asterisk/stasis_channels.h?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/include/asterisk/stasis_channels.h (original)
+++ team/kmoore/hidden_channels/include/asterisk/stasis_channels.h Thu Jun 20 20:29:48 2013
@@ -70,6 +70,7 @@
 	int caller_pres;                        /*!< Caller ID presentation. */
 	struct ast_flags flags;                 /*!< channel flags of AST_FLAG_ type */
 	struct varshead *manager_vars;          /*!< Variables to be appended to manager events */
+	int hidden;                             /*!< Determines whether the channel should be hidden from external entities */
 };
 
 /*!

Modified: team/kmoore/hidden_channels/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/main/cdr.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/main/cdr.c (original)
+++ team/kmoore/hidden_channels/main/cdr.c Thu Jun 20 20:29:48 2013
@@ -1814,11 +1814,7 @@
 /*! \internal \brief Filter channel snapshots by technology */
 static int filter_channel_snapshot(struct ast_channel_snapshot *snapshot)
 {
-	if (!strncmp(snapshot->name, "CBAnn", 5) ||
-		!strncmp(snapshot->name, "CBRec", 5)) {
-		return 1;
-	}
-	return 0;
+	return snapshot->hidden;
 }
 
 /*! \internal \brief Filter a channel cache update */

Modified: team/kmoore/hidden_channels/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/main/cel.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/main/cel.c (original)
+++ team/kmoore/hidden_channels/main/cel.c Thu Jun 20 20:29:48 2013
@@ -1190,6 +1190,14 @@
 	ao2_callback(bridge_primaries, OBJ_KEY | OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, bridge_match_cb, dup_id);
 }
 
+static int cel_filter_channel_snapshot(struct ast_channel_snapshot *snapshot)
+{
+	if (!snapshot) {
+		return 0;
+	}
+	return snapshot->hidden;
+}
+
 static void cel_snapshot_update_cb(void *data, struct stasis_subscription *sub,
 	struct stasis_topic *topic,
 	struct stasis_message *message)
@@ -1202,6 +1210,10 @@
 
 		old_snapshot = stasis_message_data(update->old_snapshot);
 		new_snapshot = stasis_message_data(update->new_snapshot);
+
+		if (cel_filter_channel_snapshot(old_snapshot) || cel_filter_channel_snapshot(new_snapshot)) {
+			return;
+		}
 
 		update_bridge_primary(new_snapshot);
 
@@ -1293,6 +1305,10 @@
 	struct ast_bridge_blob *blob = stasis_message_data(message);
 	struct ast_bridge_snapshot *snapshot = blob->bridge;
 	struct ast_channel_snapshot *chan_snapshot = blob->channel;
+
+	if (cel_filter_channel_snapshot(chan_snapshot)) {
+		return;
+	}
 
 	if (snapshot->capabilities & (AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE)) {
 		RAII_VAR(struct bridge_assoc *, assoc, find_bridge_primary_by_bridge_id(snapshot->uniqueid), ao2_cleanup);
@@ -1338,6 +1354,10 @@
 	struct ast_bridge_blob *blob = stasis_message_data(message);
 	struct ast_bridge_snapshot *snapshot = blob->bridge;
 	struct ast_channel_snapshot *chan_snapshot = blob->channel;
+
+	if (cel_filter_channel_snapshot(chan_snapshot)) {
+		return;
+	}
 
 	if (snapshot->capabilities & (AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE)) {
 		RAII_VAR(struct bridge_assoc *, assoc,
@@ -1402,6 +1422,10 @@
 {
 	struct ast_multi_channel_blob *blob = stasis_message_data(message);
 
+	if (cel_filter_channel_snapshot(ast_multi_channel_blob_get_channel(blob, "caller"))) {
+		return;
+	}
+
 	if (!get_caller_uniqueid(blob)) {
 		return;
 	}

Modified: team/kmoore/hidden_channels/main/manager_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/main/manager_bridging.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/main/manager_bridging.c (original)
+++ team/kmoore/hidden_channels/main/manager_bridging.c Thu Jun 20 20:29:48 2013
@@ -124,6 +124,7 @@
 		suffix, snapshot->technology);
 
 	if (!res) {
+		ast_free(out);
 		return NULL;
 	}
 
@@ -223,6 +224,9 @@
 
 	to_text = ast_manager_build_bridge_state_string(merge_msg->to, "");
 	from_text = ast_manager_build_bridge_state_string(merge_msg->from, "From");
+	if (!to_text || !from_text) {
+		return;
+	}
 
 	/*** DOCUMENTATION
 		<managerEventInstance>
@@ -255,6 +259,9 @@
 
 	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
 	channel_text = ast_manager_build_channel_state_string(blob->channel);
+	if (!bridge_text || !channel_text) {
+		return;
+	}
 
 	manager_event(EVENT_FLAG_CALL, "BridgeEnter",
 		"%s"
@@ -273,6 +280,9 @@
 
 	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
 	channel_text = ast_manager_build_channel_state_string(blob->channel);
+	if (!bridge_text || !channel_text) {
+		return;
+	}
 
 	manager_event(EVENT_FLAG_CALL, "BridgeLeave",
 		"%s"
@@ -295,6 +305,9 @@
 	struct mansession *s = arg;
 	char *id_text = data;
 	RAII_VAR(struct ast_str *, bridge_info, ast_manager_build_bridge_state_string(snapshot, ""), ast_free);
+	if (!bridge_info) {
+		return 0;
+	}
 
 	astman_append(s,
 		"Event: BridgeListItem\r\n"
@@ -351,6 +364,18 @@
 	char *uniqueid = obj;
 	struct mansession *s = arg;
 	char *id_text = data;
+	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+	struct ast_channel_snapshot *snapshot;
+	msg = stasis_cache_get(ast_channel_topic_all_cached(),
+		ast_channel_snapshot_type(), uniqueid);
+	if (!msg) {
+		return 0;
+	}
+
+	snapshot = stasis_message_data(msg);
+	if (snapshot->hidden) {
+		return 0;
+	}
 
 	astman_append(s,
 		"Event: BridgeInfoChannel\r\n"
@@ -403,7 +428,7 @@
 		"%s"
 		"%s"
 		"\r\n",
-		ast_str_buffer(bridge_info),
+		S_COR(bridge_info, ast_str_buffer(bridge_info), ""),
 		ast_str_buffer(id_text));
 
 	return 0;

Modified: team/kmoore/hidden_channels/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/main/manager_channels.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/main/manager_channels.c (original)
+++ team/kmoore/hidden_channels/main/manager_channels.c Thu Jun 20 20:29:48 2013
@@ -528,6 +528,12 @@
 	if (!out) {
 		return NULL;
 	}
+
+	if (snapshot->hidden) {
+		ast_free(out);
+		return NULL;
+	}
+
 	res = ast_str_set(&out, 0,
 		"%sChannel: %s\r\n"
 		"%sChannelState: %d\r\n"
@@ -555,6 +561,7 @@
 		prefix, snapshot->uniqueid);
 
 	if (!res) {
+		ast_free(out);
 		return NULL;
 	}
 
@@ -1204,6 +1211,9 @@
 	}
 
 	channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
+	if (!channel_event_string) {
+		return;
+	}
 
 	if (obj->blob) {
 		musicclass = ast_json_string_get(ast_json_object_get(obj->blob, "musicclass"));
@@ -1227,6 +1237,9 @@
 	RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
 
 	channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
+	if (!channel_event_string) {
+		return;
+	}
 
 	manager_event(EVENT_FLAG_CALL, "Unhold",
 		"%s",

Modified: team/kmoore/hidden_channels/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/main/stasis_channels.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/main/stasis_channels.c (original)
+++ team/kmoore/hidden_channels/main/stasis_channels.c Thu Jun 20 20:29:48 2013
@@ -189,6 +189,10 @@
 	snapshot->caller_pres = ast_party_id_presentation(&ast_channel_caller(chan)->id);
 
 	snapshot->manager_vars = ast_channel_get_manager_vars(chan);
+
+	if (ast_channel_tech(chan)->hidden) {
+		snapshot->hidden = ast_channel_tech(chan)->hidden(chan);
+	}
 
 	ao2_ref(snapshot, +1);
 	return snapshot;

Modified: team/kmoore/hidden_channels/res/parking/parking_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/hidden_channels/res/parking/parking_manager.c?view=diff&rev=392392&r1=392391&r2=392392
==============================================================================
--- team/kmoore/hidden_channels/res/parking/parking_manager.c (original)
+++ team/kmoore/hidden_channels/res/parking/parking_manager.c Thu Jun 20 20:29:48 2013
@@ -278,6 +278,9 @@
 	}
 
 	parkee_string = ast_manager_build_channel_state_string_prefix(payload->parkee, "Parkee");
+	if (!parkee_string) {
+		return NULL;
+	}
 
 	if (payload->parker) {
 		parker_string = ast_manager_build_channel_state_string_prefix(payload->parker, "Parker");




More information about the asterisk-commits mailing list