[svn-commits] mmichelson: branch mmichelson/features_config r390034 - /team/mmichelson/feat...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 29 13:19:46 CDT 2013


Author: mmichelson
Date: Wed May 29 13:19:42 2013
New Revision: 390034

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390034
Log:
Make attended transfer manager action use features_config


Modified:
    team/mmichelson/features_config/main/manager.c

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=390034&r1=390033&r2=390034
==============================================================================
--- team/mmichelson/features_config/main/manager.c (original)
+++ team/mmichelson/features_config/main/manager.c Wed May 29 13:19:42 2013
@@ -96,6 +96,7 @@
 #include "asterisk/test.h"
 #include "asterisk/json.h"
 #include "asterisk/bridging.h"
+#include "asterisk/features_config.h"
 
 /*** DOCUMENTATION
 	<manager name="Ping" language="en_US">
@@ -4051,8 +4052,9 @@
 	const char *exten = astman_get_header(m, "Exten");
 	const char *context = astman_get_header(m, "Context");
 	struct ast_channel *chan = NULL;
-	struct ast_call_feature *atxfer_feature = NULL;
-	char *feature_code = NULL;
+	char feature_code[FEATURE_MAX_LEN];
+	int i;
+	char *digit;
 
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
@@ -4063,30 +4065,31 @@
 		return 0;
 	}
 
-	ast_rdlock_call_features();
-	atxfer_feature = ast_find_call_feature("atxfer");
-	ast_unlock_call_features();
-	if (!atxfer_feature) {
-		astman_send_error(s, m, "No attended transfer feature found");
-		return 0;
-	}
-
 	if (!(chan = ast_channel_get_by_name(name))) {
 		astman_send_error(s, m, "Channel specified does not exist");
 		return 0;
 	}
 
+	ast_channel_lock(chan);
+	if (ast_get_builtin_feature(chan, "atxfer", feature_code, sizeof(feature_code))) {
+		ast_channel_unlock(chan);
+		astman_send_error(s, m, "No attended transfer feature code found");
+		ast_channel_unref(chan);
+		return 0;
+	}
+	ast_channel_unlock(chan);
+
 	if (!ast_strlen_zero(context)) {
 		pbx_builtin_setvar_helper(chan, "TRANSFER_CONTEXT", context);
 	}
 
-	for (feature_code = atxfer_feature->exten; feature_code && *feature_code; ++feature_code) {
-		struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *feature_code };
+	for (i = 0; i < strlen(feature_code); ++i) {
+		struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = feature_code[i] };
 		ast_queue_frame(chan, &f);
 	}
 
-	for (feature_code = (char *)exten; feature_code && *feature_code; ++feature_code) {
-		struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *feature_code };
+	for (digit = (char *)exten; digit && *digit; ++digit) {
+		struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *digit };
 		ast_queue_frame(chan, &f);
 	}
 




More information about the svn-commits mailing list