[asterisk-commits] mmichelson: branch mmichelson/features_config r390141 - in /team/mmichelson/f...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 30 12:32:28 CDT 2013


Author: mmichelson
Date: Thu May 30 12:32:26 2013
New Revision: 390141

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390141
Log:
Some general cleanup.

* Got rid of a couple more items that are no longer in use
* Added documentation to features_config.c functions that may require it
* Added XML documentation for FEATURE and FEATUREMAP functions (including new items available in FEATURE)
* Added constants for default configuration values.
* Don't allocate featuregroup container for channel datastore.


Modified:
    team/mmichelson/features_config/include/asterisk/bridging_features.h
    team/mmichelson/features_config/main/features.c
    team/mmichelson/features_config/main/features_config.c

Modified: team/mmichelson/features_config/include/asterisk/bridging_features.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/include/asterisk/bridging_features.h?view=diff&rev=390141&r1=390140&r2=390141
==============================================================================
--- team/mmichelson/features_config/include/asterisk/bridging_features.h (original)
+++ team/mmichelson/features_config/include/asterisk/bridging_features.h Thu May 30 12:32:26 2013
@@ -256,12 +256,6 @@
 /* BUGBUG the context should be figured out based upon TRANSFER_CONTEXT channel variable of A/B or current context of A/B. More appropriate for when channel moved to other bridges. */
 	/*! Context to use for transfers */
 	char context[AST_MAX_CONTEXT];
-	/*! DTMF string used to abort the transfer */
-	char abort[MAXIMUM_DTMF_FEATURE_STRING];
-	/*! DTMF string used to turn the transfer into a three way conference */
-	char threeway[MAXIMUM_DTMF_FEATURE_STRING];
-	/*! DTMF string used to complete the transfer */
-	char complete[MAXIMUM_DTMF_FEATURE_STRING];
 };
 
 /*!

Modified: team/mmichelson/features_config/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/main/features.c?view=diff&rev=390141&r1=390140&r2=390141
==============================================================================
--- team/mmichelson/features_config/main/features.c (original)
+++ team/mmichelson/features_config/main/features.c Thu May 30 12:32:26 2013
@@ -300,58 +300,6 @@
 			<para>Bridge together two channels already in the PBX.</para>
 		</description>
 	</manager>
-	<function name="FEATURE" language="en_US">
-		<synopsis>
-			Get or set a feature option on a channel.
-		</synopsis>
-		<syntax>
-			<parameter name="option_name" required="true">
-				<para>The allowed values are:</para>
-				<enumlist>
-					<enum name="parkingtime"><para>Specified in seconds.</para></enum>
-					<enum name="inherit"><para>Inherit feature settings made in FEATURE or FEATUREMAP to child channels.</para></enum>
-				</enumlist>
-			</parameter>
-		</syntax>
-		<description>
-			<para>When this function is used as a read, it will get the current
-			value of the specified feature option for this channel.  It will be
-			the value of this option configured in features.conf if a channel specific
-			value has not been set.  This function can also be used to set a channel
-			specific value for the supported feature options.</para>
-		</description>
-		<see-also>
-			<ref type="function">FEATUREMAP</ref>
-		</see-also>
-	</function>
-	<function name="FEATUREMAP" language="en_US">
-		<synopsis>
-			Get or set a feature map to a given value on a specific channel.
-		</synopsis>
-		<syntax>
-			<parameter name="feature_name" required="true">
-				<para>The allowed values are:</para>
-				<enumlist>
-					<enum name="atxfer"><para>Attended Transfer</para></enum>
-					<enum name="blindxfer"><para>Blind Transfer</para></enum>
-					<enum name="automon"><para>Auto Monitor</para></enum>
-					<enum name="disconnect"><para>Call Disconnect</para></enum>
-					<enum name="parkcall"><para>Park Call</para></enum>
-					<enum name="automixmon"><para>Auto MixMonitor</para></enum>
-				</enumlist>
-			</parameter>
-		</syntax>
-		<description>
-			<para>When this function is used as a read, it will get the current
-			digit sequence mapped to the specified feature for this channel.  This
-			value will be the one configured in features.conf if a channel specific
-			value has not been set.  This function can also be used to set a channel
-			specific value for a feature mapping.</para>
-		</description>
-		<see-also>
-			<ref type="function">FEATURE</ref>
-		</see-also>
-	</function>
 	<managerEvent language="en_US" name="ParkedCallTimeOut">
 		<managerEventInstance class="EVENT_FLAG_CALL">
 			<synopsis>Raised when a parked call times out.</synopsis>

Modified: team/mmichelson/features_config/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/main/features_config.c?view=diff&rev=390141&r1=390140&r2=390141
==============================================================================
--- team/mmichelson/features_config/main/features_config.c (original)
+++ team/mmichelson/features_config/main/features_config.c Thu May 30 12:32:26 2013
@@ -26,13 +26,104 @@
 #include "asterisk/app.h"
 #include "asterisk/cli.h"
 
-#define DEFAULT_TRANSFER_DIGIT_TIMEOUT				3000	/*!< ms */
-#define DEFAULT_FEATURE_DIGIT_TIMEOUT				1000	/*!< ms */
-#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER	15000	/*!< ms */
-#define DEFAULT_ATXFER_DROP_CALL					0		/*!< Do not drop call. */
-#define DEFAULT_ATXFER_LOOP_DELAY					10000	/*!< ms */
-#define DEFAULT_ATXFER_CALLBACK_RETRIES				2
-
+/*** DOCUMENTATION
+	<function name="FEATURE" language="en_US">
+		<synopsis>
+			Get or set a feature option on a channel.
+		</synopsis>
+		<syntax>
+			<parameter name="option_name" required="true">
+				<para>The allowed values are:</para>
+				<enumlist>
+					<enum name="inherit"><para>Inherit feature settings made in FEATURE or FEATUREMAP to child channels.</para></enum>
+					<enum name="featuredigittimeout"><para>Milliseconds allowed between digits when entering a feature code.</para></enum>
+					<enum name="transferdigittimeout"><para>Milliseconds allowed between digits when dialing a transfer destination</para></enum>
+					<enum name="atxfernoanswertimeout"><para>Milliseconds to wait for transfer destination to answer</para></enum>
+					<enum name="atxferdropcall"><para>Hang up the call entirely if the attended transfer fails</para></enum>
+					<enum name="atxferloopdelay"><para>Milliseconds to wait between attempts to re-dial transfer destination</para></enum>
+					<enum name="atxfercallbackretries"><para>Number of times to re-attempt dialing a transfer destination</para></enum>
+					<enum name="xfersound"><para>Sound to play to a transferee when a transfer completes</para></enum>
+					<enum name="xferfailsound"><para>Sound to play to a transferee when a transfer fails</para></enum>
+					<enum name="atxferabort"><para>Digits to dial to abort an attended transfer attempt</para></enum>
+					<enum name="atxfercomplete"><para>Digits to dial to complete an attended transfer</para></enum>
+					<enum name="atxferthreeway"><para>Digits to dial to change an attended transfer into a three-way call</para></enum>
+					<enum name="pickupexten"><para>Digits used for picking up ringing calls</para></enum>
+					<enum name="pickupsound"><para>Sound to play to a caller when a call is picked up</para></enum>
+					<enum name="pickupfailsound"><para>Sound to play to picker when a call cannot be picked up</para><enum>
+				</enumlist>
+			</parameter>
+		</syntax>
+		<description>
+			<para>When this function is used as a read, it will get the current
+			value of the specified feature option for this channel.  It will be
+			the value of this option configured in features.conf if a channel specific
+			value has not been set.  This function can also be used to set a channel
+			specific value for the supported feature options.</para>
+		</description>
+		<see-also>
+			<ref type="function">FEATUREMAP</ref>
+		</see-also>
+	</function>
+	<function name="FEATUREMAP" language="en_US">
+		<synopsis>
+			Get or set a feature map to a given value on a specific channel.
+		</synopsis>
+		<syntax>
+			<parameter name="feature_name" required="true">
+				<para>The allowed values are:</para>
+				<enumlist>
+					<enum name="atxfer"><para>Attended Transfer</para></enum>
+					<enum name="blindxfer"><para>Blind Transfer</para></enum>
+					<enum name="automon"><para>Auto Monitor</para></enum>
+					<enum name="disconnect"><para>Call Disconnect</para></enum>
+					<enum name="parkcall"><para>Park Call</para></enum>
+					<enum name="automixmon"><para>Auto MixMonitor</para></enum>
+				</enumlist>
+			</parameter>
+		</syntax>
+		<description>
+			<para>When this function is used as a read, it will get the current
+			digit sequence mapped to the specified feature for this channel.  This
+			value will be the one configured in features.conf if a channel specific
+			value has not been set.  This function can also be used to set a channel
+			specific value for a feature mapping.</para>
+		</description>
+		<see-also>
+			<ref type="function">FEATURE</ref>
+		</see-also>
+	</function>
+ ***/
+/*! Default general options */
+#define DEFAULT_FEATURE_DIGIT_TIMEOUT               1000
+
+/*! Default xfer options */
+#define DEFAULT_TRANSFER_DIGIT_TIMEOUT              3000
+#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER  15000
+#define DEFAULT_ATXFER_DROP_CALL                    0
+#define DEFAULT_ATXFER_LOOP_DELAY                   10000
+#define DEFAULT_ATXFER_CALLBACK_RETRIES             2
+#define DEFAULT_XFERSOUND                           "beep"
+#define DEFAULT_XFERFAILSOUND                       "beeperr"
+#define DEFAULT_ATXFER_ABORT                        "*1"
+#define DEFAULT_ATXFER_COMPLETE                     "*2"
+#define DEFAULT_ATXFER_THREEWAY                     "*3"
+
+/*! Default pickup options */
+#define DEFAULT_PICKUPEXTEN                         "*8"
+#define DEFAULT_PICKUPSOUND                         ""
+#define DEFAULT_PICKUPFAILSOUND                     ""
+
+/*! Default featuremap options */
+#define DEFAULT_FEATUREMAP_BLINDXFER                "#"
+#define DEFAULT_FEATUREMAP_DISCONNECT               "*"
+#define DEFAULT_FEATUREMAP_AUTOMON                  ""
+#define DEFAULT_FEATUREMAP_ATXFER                   ""
+#define DEFAULT_FEATUREMAP_PARKCALL                 ""
+#define DEFAULT_FEATUREMAP_AUTOMIXMON               ""
+
+/*!
+ * \brief Configuration from the "general" section of features.conf
+ */
 struct features_global_config {
 	struct ast_features_general_config *general;
 	struct ast_features_xfer_config *xfer;
@@ -66,11 +157,17 @@
 	}
 }
 
+/*!
+ * \brief Entry in the container of featuregroups
+ */
 struct featuregroup_item {
 	AST_DECLARE_STRING_FIELDS(
+		/*! The name of the applicationmap item that we are referring to */
 		AST_STRING_FIELD(appmap_item_name);
+		/*! Custom DTMF override to use instead of the default for the applicationmap item */
 		AST_STRING_FIELD(dtmf_override);
 	);
+	/*! The applicationmap item that is being referred to */
 	struct ast_applicationmap_item *appmap_item;
 };
 
@@ -122,8 +219,13 @@
 	}
 }
 
+/*!
+ * \brief Featuregroup representation
+ */
 struct featuregroup {
+	/*! The name of the featuregroup */
 	const char *name;
+	/*! A container of featuregroup_items */
 	struct ao2_container *items;
 };
 
@@ -195,7 +297,8 @@
 		return NULL;
 	}
 
-	group->items = ao2_container_alloc(5, group_item_hash, group_item_cmp);
+	group->items = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 5,
+			group_item_hash, group_item_cmp);
 	if (!group->items) {
 		ao2_cleanup(group);
 		return NULL;
@@ -330,6 +433,19 @@
 			AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, applicationmap_sort, NULL);
 }
 
+/*!
+ * \internal
+ * \brief Allocate the major configuration structure
+ *
+ * The parameter is used to determine if the applicationmap and featuregroup
+ * structures should be allocated. We only want to allocate these structures for
+ * the global features_config structure. For the datastores on channels, we don't
+ * need to allocate these structures because they are not used.
+ *
+ * \param allocate_applicationmap See previous explanation
+ * \retval NULL Failed to alloate configuration
+ * \retval non-NULL Allocated configuration
+ */
 static struct features_config *__features_config_alloc(int allocate_applicationmap)
 {
 	RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
@@ -354,10 +470,13 @@
 		if (!cfg->applicationmap) {
 			return NULL;
 		}
-	}
-
-	cfg->featuregroups = ao2_container_alloc(11, featuregroup_hash,
+
+		cfg->featuregroups = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 11, featuregroup_hash,
 			featuregroup_cmp);
+		if (!cfg->featuregroups) {
+			return NULL;
+		}
+	}
 
 	ao2_ref(cfg, +1);
 	return cfg;
@@ -1197,41 +1316,39 @@
 	aco_option_register_custom(&cfg_info, "atxfercallbackretries", ACO_EXACT, global_options,
 			__stringify(DEFAULT_ATXFER_CALLBACK_RETRIES), xfer_handler, 0);
 	aco_option_register_custom(&cfg_info, "xfersound", ACO_EXACT, global_options,
-			"beep", xfer_handler, 0);
+			DEFAULT_XFERSOUND, xfer_handler, 0);
 	aco_option_register_custom(&cfg_info, "xferfailsound", ACO_EXACT, global_options,
-			"beeperr", xfer_handler, 0);
+			DEFAULT_XFERFAILSOUND, xfer_handler, 0);
 	aco_option_register_custom(&cfg_info, "atxferabort", ACO_EXACT, global_options,
-			"*1", xfer_handler, 0);
+			DEFAULT_ATXFER_ABORT, xfer_handler, 0);
 	aco_option_register_custom(&cfg_info, "atxfercomplete", ACO_EXACT, global_options,
-			"*2", xfer_handler, 0);
+			DEFAULT_ATXFER_COMPLETE, xfer_handler, 0);
 	aco_option_register_custom(&cfg_info, "atxferthreeway", ACO_EXACT, global_options,
-			"*3", xfer_handler, 0);
+			DEFAULT_ATXFER_THREEWAY, xfer_handler, 0);
 
 	aco_option_register_custom(&cfg_info, "pickupexten", ACO_EXACT, global_options,
-			"*8", pickup_handler, 0);
+			DEFAULT_PICKUPEXTEN, pickup_handler, 0);
 	aco_option_register_custom(&cfg_info, "pickupsound", ACO_EXACT, global_options,
-			"", pickup_handler, 0);
+			DEFAULT_PICKUPSOUND, pickup_handler, 0);
 	aco_option_register_custom(&cfg_info, "pickupfailsound", ACO_EXACT, global_options,
-			"", pickup_handler, 0);
+			DEFAULT_PICKUPFAILSOUND, pickup_handler, 0);
 
 	aco_option_register_custom(&cfg_info, "blindxfer", ACO_EXACT, featuremap_options,
-			"#", featuremap_handler, 0);
+			DEFAULT_FEATUREMAP_BLINDXFER, featuremap_handler, 0);
 	aco_option_register_custom(&cfg_info, "disconnect", ACO_EXACT, featuremap_options,
-			"*", featuremap_handler, 0);
+			DEFAULT_FEATUREMAP_DISCONNECT, featuremap_handler, 0);
 	aco_option_register_custom(&cfg_info, "automon", ACO_EXACT, featuremap_options,
-			"", featuremap_handler, 0);
+			DEFAULT_FEATUREMAP_AUTOMON, featuremap_handler, 0);
 	aco_option_register_custom(&cfg_info, "atxfer", ACO_EXACT, featuremap_options,
-			"", featuremap_handler, 0);
+			DEFAULT_FEATUREMAP_ATXFER, featuremap_handler, 0);
 	aco_option_register_custom(&cfg_info, "parkcall", ACO_EXACT, featuremap_options,
-			"", featuremap_handler, 0);
+			DEFAULT_FEATUREMAP_PARKCALL, featuremap_handler, 0);
 	aco_option_register_custom(&cfg_info, "automixmon", ACO_EXACT, featuremap_options,
-			"", featuremap_handler, 0);
+			DEFAULT_FEATUREMAP_AUTOMIXMON, featuremap_handler, 0);
 	
-	/* XXX This regex may need to be more specific */
 	aco_option_register_custom(&cfg_info, "^.*$", ACO_REGEX, applicationmap_options,
 			"", applicationmap_handler, 0);
 
-	/* XXX This regex may need to be more specific */
 	aco_option_register_custom(&cfg_info, "^.*$", ACO_REGEX, featuregroup_options,
 			"", featuregroup_handler, 0);
 
@@ -1310,13 +1427,13 @@
 	ast_cli(a->fd, HFS_FORMAT, "Builtin Feature", "Default", "Current");
 	ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
 
-	ast_cli(a->fd, HFS_FORMAT, "Pickup", "*8", cfg->global->pickup->pickupexten);          /* default hardcoded above, so we'll hardcode it here */
-	ast_cli(a->fd, HFS_FORMAT, "Blind Transfer", "#", cfg->featuremap->blindxfer);
-	ast_cli(a->fd, HFS_FORMAT, "Attended Transfer", "", cfg->featuremap->atxfer);
-	ast_cli(a->fd, HFS_FORMAT, "One Touch Monitor", "", cfg->featuremap->automon);
-	ast_cli(a->fd, HFS_FORMAT, "Disconnect Call", "*", cfg->featuremap->disconnect);
-	ast_cli(a->fd, HFS_FORMAT, "Park Call", "", cfg->featuremap->parkcall);
-	ast_cli(a->fd, HFS_FORMAT, "One Touch MixMonitor", "", cfg->featuremap->automixmon);
+	ast_cli(a->fd, HFS_FORMAT, "Pickup", DEFAULT_PICKUPEXTEN, cfg->global->pickup->pickupexten);
+	ast_cli(a->fd, HFS_FORMAT, "Blind Transfer", DEFAULT_FEATUREMAP_BLINDXFER, cfg->featuremap->blindxfer);
+	ast_cli(a->fd, HFS_FORMAT, "Attended Transfer", DEFAULT_FEATUREMAP_ATXFER, cfg->featuremap->atxfer);
+	ast_cli(a->fd, HFS_FORMAT, "One Touch Monitor", DEFAULT_FEATUREMAP_AUTOMON, cfg->featuremap->automon);
+	ast_cli(a->fd, HFS_FORMAT, "Disconnect Call", DEFAULT_FEATUREMAP_DISCONNECT, cfg->featuremap->disconnect);
+	ast_cli(a->fd, HFS_FORMAT, "Park Call", DEFAULT_FEATUREMAP_PARKCALL, cfg->featuremap->parkcall);
+	ast_cli(a->fd, HFS_FORMAT, "One Touch MixMonitor", DEFAULT_FEATUREMAP_AUTOMIXMON, cfg->featuremap->automixmon);
 
 	ast_cli(a->fd, "\n");
 	ast_cli(a->fd, HFS_FORMAT, "Dynamic Feature", "Default", "Current");




More information about the asterisk-commits mailing list