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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 29 17:03:05 CDT 2013


Author: mmichelson
Date: Wed May 29 17:03:00 2013
New Revision: 390104

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390104
Log:
Get rid of builtin features.

This commit comments out a TON of dead code in features.c
Some of the code could probably just be outright removed, but
I decided to stay on the safe side and leave the code as an example
that may need to be followed for the builtin feature implementation
in the bridging features code.


Modified:
    team/mmichelson/features_config/apps/app_dial.c
    team/mmichelson/features_config/channels/chan_sip.c
    team/mmichelson/features_config/channels/sip/include/sip.h
    team/mmichelson/features_config/include/asterisk/channel.h
    team/mmichelson/features_config/include/asterisk/features.h
    team/mmichelson/features_config/include/asterisk/features_config.h
    team/mmichelson/features_config/main/features.c
    team/mmichelson/features_config/main/manager.c

Modified: team/mmichelson/features_config/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/apps/app_dial.c?view=diff&rev=390104&r1=390103&r2=390104
==============================================================================
--- team/mmichelson/features_config/apps/app_dial.c (original)
+++ team/mmichelson/features_config/apps/app_dial.c Wed May 29 17:03:00 2013
@@ -1075,7 +1075,7 @@
 	int caller_entertained = outgoing
 		&& ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
 	struct ast_party_connected_line connected_caller;
-	struct ast_str *featurecode = ast_str_alloca(FEATURE_MAX_LEN + 1);
+	struct ast_str *featurecode = ast_str_alloca(AST_FEATURE_MAX_LEN + 1);
 	int cc_recall_core_id;
 	int is_cc_recall;
 	int cc_frame_received = 0;
@@ -1702,7 +1702,7 @@
 
 static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str **featurecode)
 {
-	char disconnect_code[FEATURE_MAX_LEN];
+	char disconnect_code[AST_FEATURE_MAX_LEN];
 	int res;
 
 	ast_str_append(featurecode, 1, "%c", code);

Modified: team/mmichelson/features_config/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/channels/chan_sip.c?view=diff&rev=390104&r1=390103&r2=390104
==============================================================================
--- team/mmichelson/features_config/channels/chan_sip.c (original)
+++ team/mmichelson/features_config/channels/chan_sip.c Wed May 29 17:03:00 2013
@@ -21699,7 +21699,7 @@
 		 * on phone calls.
 		 */
 
-		char feat[FEATURE_MAX_LEN];
+		char feat[AST_FEATURE_MAX_LEN];
 		int feat_res = -1;
 		int j;
 		struct ast_frame f = { AST_FRAME_DTMF, };

Modified: team/mmichelson/features_config/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/channels/sip/include/sip.h?view=diff&rev=390104&r1=390103&r2=390104
==============================================================================
--- team/mmichelson/features_config/channels/sip/include/sip.h (original)
+++ team/mmichelson/features_config/channels/sip/include/sip.h Wed May 29 17:03:00 2013
@@ -38,6 +38,7 @@
 #include "asterisk/http_websocket.h"
 #include "asterisk/rtp_engine.h"
 #include "asterisk/netsock2.h"
+#include "asterisk/features_config.h"
 
 #ifndef FALSE
 #define FALSE    0
@@ -762,8 +763,8 @@
 	struct sip_proxy outboundproxy; /*!< Outbound proxy */
 	char default_context[AST_MAX_CONTEXT];
 	char default_subscribecontext[AST_MAX_CONTEXT];
-	char default_record_on_feature[FEATURE_MAX_LEN];
-	char default_record_off_feature[FEATURE_MAX_LEN];
+	char default_record_on_feature[AST_FEATURE_MAX_LEN];
+	char default_record_off_feature[AST_FEATURE_MAX_LEN];
 	struct ast_acl_list *contact_acl;  /*! \brief Global list of addresses dynamic peers are not allowed to use */
 	struct ast_format_cap *caps; /*!< Supported codecs */
 	int tcp_enabled;

Modified: team/mmichelson/features_config/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/include/asterisk/channel.h?view=diff&rev=390104&r1=390103&r2=390104
==============================================================================
--- team/mmichelson/features_config/include/asterisk/channel.h (original)
+++ team/mmichelson/features_config/include/asterisk/channel.h Wed May 29 17:03:00 2013
@@ -929,6 +929,9 @@
 	AST_FEATURE_AUTOMIXMON =   (1 << 6),
 	AST_FEATURE_WARNING_ACTIVE = (1 << 8),
 };
+
+#define AST_FEATURE_DTMF_MASK AST_FEATURE_REDIRECT | AST_FEATURE_DISCONNECT |\
+	AST_FEATURE_ATXFER | AST_FEATURE_AUTOMON | AST_FEATURE_PARKCALL | AST_FEATURE_AUTOMIXMON
 
 /*! \brief bridge configuration */
 struct ast_bridge_config {

Modified: team/mmichelson/features_config/include/asterisk/features.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/include/asterisk/features.h?view=diff&rev=390104&r1=390103&r2=390104
==============================================================================
--- team/mmichelson/features_config/include/asterisk/features.h (original)
+++ team/mmichelson/features_config/include/asterisk/features.h Wed May 29 17:03:00 2013
@@ -62,20 +62,6 @@
 	AST_FEATURE_FLAG_BYBOTH	 =   (3 << 3),
 };
 
-struct ast_call_feature {
-	int feature_mask;
-	char *fname;
-	char sname[FEATURE_SNAME_LEN];
-	char exten[FEATURE_MAX_LEN];
-	char default_exten[FEATURE_MAX_LEN];
-	ast_feature_operation operation;
-	unsigned int flags;
-	char app[FEATURE_APP_LEN];		
-	char app_args[FEATURE_APP_ARGS_LEN];
-	char moh_class[FEATURE_MOH_LEN];
-	AST_LIST_ENTRY(ast_call_feature) feature_entry;
-};
-
 /*!
  * \brief Park a call and read back parked location
  *

Modified: team/mmichelson/features_config/include/asterisk/features_config.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/include/asterisk/features_config.h?view=diff&rev=390104&r1=390103&r2=390104
==============================================================================
--- team/mmichelson/features_config/include/asterisk/features_config.h (original)
+++ team/mmichelson/features_config/include/asterisk/features_config.h Wed May 29 17:03:00 2013
@@ -184,7 +184,7 @@
  */
 int ast_get_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len);
 
-#define FEATURE_MAX_LEN 11
+#define AST_FEATURE_MAX_LEN 11
 
 /*!
  * \brief An applicationmap configuration item
@@ -201,7 +201,7 @@
 		AST_STRING_FIELD(moh_class);
 	);
 	/* DTMF key sequence used to activate the feature */
-	char dtmf[FEATURE_MAX_LEN];
+	char dtmf[AST_FEATURE_MAX_LEN];
 	/* If true, activate on party that input the sequence, otherwise activate on the other party */
 	unsigned int activate_on_self;
 };

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=390104&r1=390103&r2=390104
==============================================================================
--- team/mmichelson/features_config/main/features.c (original)
+++ team/mmichelson/features_config/main/features.c Wed May 29 17:03:00 2013
@@ -586,7 +586,6 @@
 #endif
 
 static int parkeddynamic = 0;                              /*!< Enable creation of parkinglots dynamically */
-static char courtesytone[256];                             /*!< Courtesy tone used to pickup parked calls and on-touch-record */
 
 /*!
  * \brief Context for parking dialback to parker.
@@ -847,6 +846,7 @@
 	ast_channel_priority_set(chan, pri);
 }
 
+#if 0
 /*!
  * \brief Check goto on transfer
  * \param chan
@@ -905,17 +905,21 @@
 		ast_hangup(xferchan);
 	}
 }
-
+#endif
+
+#if 0
 static struct ast_channel *feature_request_and_dial(struct ast_channel *caller,
 	const char *caller_name, struct ast_channel *requestor,
 	struct ast_channel *transferee, const char *type, struct ast_format_cap *cap, const char *addr,
 	int timeout, int *outstate, const char *language);
+#endif
 
 static const struct ast_datastore_info channel_app_data_datastore = {
 	.type = "Channel appdata datastore",
 	.destroy = ast_free_ptr,
 };
 
+#if 0
 static int set_chan_app_data(struct ast_channel *chan, const char *src_app_data)
 {
 	struct ast_datastore *datastore;
@@ -937,7 +941,9 @@
 	ast_channel_datastore_add(chan, datastore);
 	return 0;
 }
-
+#endif
+
+#if 0
 /*!
  * \brief bridge the call
  * \param data thread bridge.
@@ -980,7 +986,9 @@
 
 	return NULL;
 }
-
+#endif
+
+#if 0
 /*!
  * \brief create thread for the bridging call
  * \param tobj
@@ -1000,6 +1008,7 @@
 		ast_free(tobj);
 	}
 }
+#endif
 
 /*!
  * \brief Announce call parking by ADSI
@@ -1838,13 +1847,16 @@
 	return masq_park_call(rchan, peer, &args);
 }
 
+#if 0
 static int finishup(struct ast_channel *chan)
 {
 	ast_indicate(chan, AST_CONTROL_UNHOLD);
 
 	return ast_autoservice_stop(chan);
 }
-
+#endif
+
+#if 0
 /*!
  * \internal
  * \brief Builtin transfer park call helper.
@@ -1912,7 +1924,9 @@
 
 	return res ? AST_FEATURE_RETURN_SUCCESS : -1;
 }
-
+#endif
+
+#if 0
 /*!
  * \brief set caller and callee according to the direction
  * \param caller, callee, peer, chan, sense
@@ -1930,7 +1944,9 @@
 		*caller = chan;
 	}
 }
-
+#endif
+
+#if 0
 /*!
  * \brief support routing for one touch call parking
  * \param chan channel parking call
@@ -1979,6 +1995,7 @@
 	set_peers(&parker, &parkee, peer, chan, sense);
 	return masq_park_call(parkee, parker, &args) ? AST_FEATURE_RETURN_SUCCESS : -1;
 }
+#endif
 
 /*!
  * \internal
@@ -2011,6 +2028,7 @@
 	return 0;
 }
 
+#if 0
 /*!
  * \internal
  * \brief Play file to specified channels.
@@ -2041,7 +2059,9 @@
 
 	return 0;
 }
-
+#endif
+
+#if 0
 /*!
  * \brief Play message to both caller and callee in bridged call, plays synchronously, autoservicing the
  * other channel during the message, so please don't use this for very long messages
@@ -2051,7 +2071,9 @@
 	return play_message_to_chans(caller_chan, callee_chan, 0, "automon message",
 		audiofile);
 }
-
+#endif
+
+#if 0
 /*!
  * \brief Monitor a channel by DTMF
  * \param chan channel requesting monitor
@@ -2154,7 +2176,9 @@
 
 	return AST_FEATURE_RETURN_SUCCESS;
 }
-
+#endif
+
+#if 0
 static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
 {
 	char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL;
@@ -2254,13 +2278,17 @@
 	pbx_builtin_setvar_helper(caller_chan, "TOUCH_MIXMONITOR_OUTPUT", touch_filename);
 	return AST_FEATURE_RETURN_SUCCESS;
 }
-
+#endif
+
+#if 0
 static int builtin_disconnect(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
 {
 	ast_verb(4, "User hit '%s' to disconnect call.\n", code);
 	return AST_FEATURE_RETURN_HANGUP;
 }
-
+#endif
+
+#if 0
 /*!
  * \brief Find the context for the transfer
  * \param transferer
@@ -2283,7 +2311,9 @@
 	}
 	return s;
 }
-
+#endif
+
+#if 0
 /*!
  * \brief Blind transfer user to another extension
  * \param chan channel to be transfered
@@ -2403,7 +2433,9 @@
 	check_goto_on_transfer(transferer);
 	return res;
 }
-
+#endif
+
+#if 0
 /*!
  * \brief make channels compatible
  * \param c
@@ -2421,7 +2453,9 @@
 	}
 	return 0;
 }
-
+#endif
+
+#if 0
 /*!
  * \internal
  * \brief Builtin attended transfer failed cleanup.
@@ -2451,7 +2485,9 @@
 	}
 	ast_party_connected_line_free(connected_line);
 }
-
+#endif
+
+#if 0
 /*!
  * \brief Attended transfer
  * \param chan transfered user
@@ -2910,19 +2946,7 @@
 	ast_party_connected_line_free(&connected_line);
 	return -1;/* The transferee is masqueraded and the original bridged channels can be hungup. */
 }
-
-/* add atxfer and automon as undefined so you can only use em if you configure them */
-#define FEATURES_COUNT ARRAY_LEN(builtin_features)
-
-/*! \note This is protected by features_lock. */
-static struct ast_call_feature builtin_features[] = {
-	{ AST_FEATURE_REDIRECT, "Blind Transfer", "blindxfer", "#", "#", builtin_blindtransfer, AST_FEATURE_FLAG_NEEDSDTMF, "" },
-	{ AST_FEATURE_REDIRECT, "Attended Transfer", "atxfer", "", "", builtin_atxfer, AST_FEATURE_FLAG_NEEDSDTMF, "" },
-	{ AST_FEATURE_AUTOMON, "One Touch Monitor", "automon", "", "", builtin_automonitor, AST_FEATURE_FLAG_NEEDSDTMF, "" },
-	{ AST_FEATURE_DISCONNECT, "Disconnect Call", "disconnect", "*", "*", builtin_disconnect, AST_FEATURE_FLAG_NEEDSDTMF, "" },
-	{ AST_FEATURE_PARKCALL, "Park Call", "parkcall", "", "", builtin_parkcall, AST_FEATURE_FLAG_NEEDSDTMF, "" },
-	{ AST_FEATURE_AUTOMIXMON, "One Touch MixMonitor", "automixmon", "", "", builtin_automixmonitor, AST_FEATURE_FLAG_NEEDSDTMF, "" },
-};
+#endif
 
 /*!
  * \internal
@@ -3231,22 +3255,16 @@
 
 static void set_config_flags(struct ast_channel *chan, struct ast_bridge_config *config)
 {
-	int x;
-
 /* BUGBUG there is code that checks AST_BRIDGE_IGNORE_SIGS but no code to set it. */
 /* BUGBUG there is code that checks AST_BRIDGE_REC_CHANNEL_0 but no code to set it. */
 /* BUGBUG there is code that checks AST_BRIDGE_REC_CHANNEL_1 but no code to set it. */
 	ast_clear_flag(config, AST_FLAGS_ALL);
 
-	for (x = 0; x < FEATURES_COUNT; x++) {
-		if (!ast_test_flag(builtin_features + x, AST_FEATURE_FLAG_NEEDSDTMF))
-			continue;
-
-		if (ast_test_flag(&(config->features_caller), builtin_features[x].feature_mask))
-			ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
-
-		if (ast_test_flag(&(config->features_callee), builtin_features[x].feature_mask))
-			ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_1);
+	if (ast_test_flag(&config->features_caller, AST_FEATURE_DTMF_MASK)) {
+		ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
+	}
+	if (ast_test_flag(&config->features_callee, AST_FEATURE_DTMF_MASK)) {
+		ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_1);
 	}
 
 	if (!(ast_test_flag(config, AST_BRIDGE_DTMF_CHANNEL_0) && ast_test_flag(config, AST_BRIDGE_DTMF_CHANNEL_1))) {
@@ -3265,6 +3283,7 @@
 	}
 }
 
+#if 0
 /*!
  * \internal
  * \brief Get feature and dial.
@@ -3316,7 +3335,7 @@
 	int ready = 0;
 	struct timeval started;
 	int x, len = 0;
-	char disconnect_code[FEATURE_MAX_LEN];
+	char disconnect_code[AST_FEATURE_MAX_LEN];
 	char *dialed_code = NULL;
 	struct ast_format_cap *tmp_cap;
 	struct ast_format best_audio_fmt;
@@ -3603,6 +3622,7 @@
 
 	return chan;
 }
+#endif
 
 void ast_channel_log(char *title, struct ast_channel *chan);
 
@@ -3731,7 +3751,7 @@
 static int setup_bridge_features_builtin(struct ast_bridge_features *features, struct ast_channel *chan)
 {
 	struct ast_flags *flags;
-	char dtmf[FEATURE_MAX_LEN];
+	char dtmf[AST_FEATURE_MAX_LEN];
 	int res;
 
 	ast_channel_lock(chan);

Modified: team/mmichelson/features_config/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/main/manager.c?view=diff&rev=390104&r1=390103&r2=390104
==============================================================================
--- team/mmichelson/features_config/main/manager.c (original)
+++ team/mmichelson/features_config/main/manager.c Wed May 29 17:03:00 2013
@@ -4052,7 +4052,7 @@
 	const char *exten = astman_get_header(m, "Exten");
 	const char *context = astman_get_header(m, "Context");
 	struct ast_channel *chan = NULL;
-	char feature_code[FEATURE_MAX_LEN];
+	char feature_code[AST_FEATURE_MAX_LEN];
 	int i;
 	char *digit;
 




More information about the asterisk-commits mailing list