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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 8 15:20:17 CDT 2013


Author: kmoore
Date: Mon Jul  8 15:20:14 2013
New Revision: 393840

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393840
Log:
Simplify role descriptors as channel tech property flags

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/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

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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/apps/confbridge/conf_chan_announce.c (original)
+++ team/kmoore/hidden_channels/apps/confbridge/conf_chan_announce.c Mon Jul  8 15:20:14 2013
@@ -113,11 +113,6 @@
 	}
 
 	return chan;
-}
-
-static const char *announce_role_description(struct ast_channel *chan)
-{
-	return "app_confbridge announcer";
 }
 
 static struct ast_channel_tech announce_tech = {
@@ -139,7 +134,7 @@
 	.send_text = ast_unreal_sendtext,
 	.queryoption = ast_unreal_queryoption,
 	.setoption = ast_unreal_setoption,
-	.get_role_description = announce_role_description,
+	.properties = AST_CHAN_TP_ANNOUNCER,
 };
 
 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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/apps/confbridge/conf_chan_record.c (original)
+++ team/kmoore/hidden_channels/apps/confbridge/conf_chan_record.c Mon Jul  8 15:20:14 2013
@@ -79,11 +79,6 @@
 	return chan;
 }
 
-static const char *rec_role_description(struct ast_channel *chan)
-{
-	return "app_confbridge recorder";
-}
-
 static struct ast_channel_tech record_tech = {
 	.type = "CBRec",
 	.description = "Conference Bridge Recording Channel",
@@ -91,7 +86,7 @@
 	.call = rec_call,
 	.read = rec_read,
 	.write = rec_write,
-	.get_role_description = rec_role_description,
+	.properties = AST_CHAN_TP_RECORDER,
 };
 
 struct ast_channel_tech *conf_record_get_tech(void)

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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/include/asterisk/channel.h (original)
+++ team/kmoore/hidden_channels/include/asterisk/channel.h Mon Jul  8 15:20:14 2013
@@ -737,18 +737,6 @@
 	 * \retval -1 on error.
 	 */
 	int (*pre_call)(struct ast_channel *chan, const char *sub_args);
-
-	/*!
-	 * \brief Provide a textual description of this channel's role if and only
-	 * if it is an implementation detail of a feature, subsystem, or application.
-	 * \since 12.0
-	 *
-	 * \param chan Channel to check.
-	 *
-	 * \retval A string describing the channel's role if it is an implementation detail.
-	 * \retval NULL if the channel is not an implementation detail.
-	 */
-	const char *(*get_role_description)(struct ast_channel *chan);
 };
 
 /*! Kill the channel channel driver technology descriptor. */
@@ -860,15 +848,25 @@
 /*! \brief ast_channel_tech Properties */
 enum {
 	/*!
-     * \brief Channels have this property if they can accept input with jitter;
+	 * \brief Channels have this property if they can accept input with jitter;
 	 * i.e. most VoIP channels
 	 */
 	AST_CHAN_TP_WANTSJITTER = (1 << 0),
 	/*!
-     * \brief Channels have this property if they can create jitter;
+	 * \brief Channels have this property if they can create jitter;
 	 * i.e. most VoIP channels
 	 */
 	AST_CHAN_TP_CREATESJITTER = (1 << 1),
+	/*!
+	 * \brief Channels have this property if they are an implementation detail
+	 * used for announcing messages; i.e. to a bridge
+	 */
+	AST_CHAN_TP_ANNOUNCER = (1 << 2),
+	/*!
+	 * \brief Channels have this property if they are an implementation detail
+	 * used for recording audio; i.e. from a bridge
+	 */
+	AST_CHAN_TP_RECORDER = (1 << 3),
 };
 
 /*! \brief ast_channel flags */

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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/include/asterisk/stasis_channels.h (original)
+++ team/kmoore/hidden_channels/include/asterisk/stasis_channels.h Mon Jul  8 15:20:14 2013
@@ -60,7 +60,6 @@
 		AST_STRING_FIELD(connected_name);   /*!< Connected Line Name */
 		AST_STRING_FIELD(connected_number); /*!< Connected Line Number */
 		AST_STRING_FIELD(language);         /*!< The default spoken language for the channel */
-		AST_STRING_FIELD(role_description); /*!< A description of this channel's role if applicable */
 	);
 
 	struct timeval creationtime;            /*!< The time of channel creation */
@@ -71,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 tech_properties;                    /*!< Properties of the channel's technology */
 };
 
 /*!

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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/main/cdr.c (original)
+++ team/kmoore/hidden_channels/main/cdr.c Mon Jul  8 15:20:14 2013
@@ -1814,7 +1814,7 @@
 /*! \internal \brief Filter channel snapshots by technology */
 static int filter_channel_snapshot(struct ast_channel_snapshot *snapshot)
 {
-	return !ast_strlen_zero(snapshot->role_description);
+	return snapshot->tech_properties & (AST_CHAN_TP_ANNOUNCER | AST_CHAN_TP_RECORDER);
 }
 
 /*! \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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/main/cel.c (original)
+++ team/kmoore/hidden_channels/main/cel.c Mon Jul  8 15:20:14 2013
@@ -1195,7 +1195,7 @@
 	if (!snapshot) {
 		return 0;
 	}
-	return !ast_strlen_zero(snapshot->role_description);
+	return snapshot->tech_properties & (AST_CHAN_TP_ANNOUNCER | AST_CHAN_TP_RECORDER);
 }
 
 static void cel_snapshot_update_cb(void *data, struct stasis_subscription *sub,

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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/main/manager_bridging.c (original)
+++ team/kmoore/hidden_channels/main/manager_bridging.c Mon Jul  8 15:20:14 2013
@@ -373,7 +373,7 @@
 	}
 
 	snapshot = stasis_message_data(msg);
-	if (!ast_strlen_zero(snapshot->role_description)) {
+	if (snapshot->tech_properties & (AST_CHAN_TP_ANNOUNCER | AST_CHAN_TP_RECORDER)) {
 		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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/main/manager_channels.c (original)
+++ team/kmoore/hidden_channels/main/manager_channels.c Mon Jul  8 15:20:14 2013
@@ -529,7 +529,7 @@
 		return NULL;
 	}
 
-	if (!ast_strlen_zero(snapshot->role_description)) {
+	if (snapshot->tech_properties & (AST_CHAN_TP_ANNOUNCER | AST_CHAN_TP_RECORDER)) {
 		ast_free(out);
 		return NULL;
 	}

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=393840&r1=393839&r2=393840
==============================================================================
--- team/kmoore/hidden_channels/main/stasis_channels.c (original)
+++ team/kmoore/hidden_channels/main/stasis_channels.c Mon Jul  8 15:20:14 2013
@@ -189,10 +189,7 @@
 	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)->get_role_description) {
-		ast_string_field_set(snapshot, role_description, ast_channel_tech(chan)->get_role_description(chan));
-	}
+	snapshot->tech_properties = ast_channel_tech(chan)->properties;
 
 	ao2_ref(snapshot, +1);
 	return snapshot;




More information about the asterisk-commits mailing list