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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 29 14:56:15 CDT 2013


Author: mmichelson
Date: Wed May 29 14:56:11 2013
New Revision: 390043

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390043
Log:
Switch app_dial to detect the disconnect feature properly.

This meant that no one used ast_feature_detect() any longer,
so it is now commented out in features.c


Modified:
    team/mmichelson/features_config/apps/app_dial.c
    team/mmichelson/features_config/include/asterisk/features.h
    team/mmichelson/features_config/main/features.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=390043&r1=390042&r2=390043
==============================================================================
--- team/mmichelson/features_config/apps/app_dial.c (original)
+++ team/mmichelson/features_config/apps/app_dial.c Wed May 29 14:56:11 2013
@@ -69,6 +69,7 @@
 #include "asterisk/dial.h"
 #include "asterisk/stasis_channels.h"
 #include "asterisk/bridging.h"
+#include "asterisk/features_config.h"
 
 /*** DOCUMENTATION
 	<application name="Dial" language="en_US">
@@ -1701,22 +1702,31 @@
 
 static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str **featurecode)
 {
-	struct ast_flags features = { AST_FEATURE_DISCONNECT }; /* only concerned with disconnect feature */
-	struct ast_call_feature feature = { 0, };
+	char disconnect_code[FEATURE_MAX_LEN];
 	int res;
 
 	ast_str_append(featurecode, 1, "%c", code);
 
-	res = ast_feature_detect(chan, &features, ast_str_buffer(*featurecode), &feature);
-
-	if (res != AST_FEATURE_RETURN_STOREDIGITS) {
+	res = ast_get_builtin_feature(chan, "disconnect", disconnect_code, sizeof(disconnect_code));
+	if (res) {
 		ast_str_reset(*featurecode);
-	}
-	if (feature.feature_mask & AST_FEATURE_DISCONNECT) {
-		return 1;
-	}
-
-	return 0;
+		return 0;
+	}
+
+	if (strlen(disconnect_code) > ast_str_strlen(*featurecode)) {
+		/* Could be a partial match, anyway */
+		if (strncmp(disconnect_code, ast_str_buffer(*featurecode), ast_str_strlen(*featurecode))) {
+			ast_str_reset(*featurecode);
+		}
+		return 0;
+	}
+
+	if (strcmp(disconnect_code, ast_str_buffer(*featurecode))) {
+		ast_str_reset(*featurecode);
+		return 0;
+	}
+
+	return 1;
 }
 
 /* returns true if there is a valid privacy reply */

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=390043&r1=390042&r2=390043
==============================================================================
--- team/mmichelson/features_config/include/asterisk/features.h (original)
+++ team/mmichelson/features_config/include/asterisk/features.h Wed May 29 14:56:11 2013
@@ -232,16 +232,6 @@
 */
 void ast_unregister_feature(struct ast_call_feature *feature);
 
-/*! 
- * \brief detect a feature before bridging 
- * \param chan
- * \param features an ast_flags ptr
- * \param code ptr of input code
- * \param feature
- * \retval ast_call_feature ptr to be set if found 
-*/
-int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature);
-
 void ast_rdlock_call_features(void);
 void ast_unlock_call_features(void);
 

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=390043&r1=390042&r2=390043
==============================================================================
--- team/mmichelson/features_config/main/features.c (original)
+++ team/mmichelson/features_config/main/features.c Wed May 29 14:56:11 2013
@@ -3117,6 +3117,7 @@
 }
 #endif
 
+#if 0
 /*!
  * \brief Helper function for feature_interpret and ast_feature_detect
  * \param chan,peer,config,code,sense,dynamic_features_buf,features,operation,feature
@@ -3251,6 +3252,7 @@
 
 	return res;
 }
+#endif
 
 #if 0//BUGBUG
 /*!
@@ -3302,9 +3304,11 @@
 #endif
 
 
+#if 0
 int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature) {
 	return feature_interpret_helper(chan, NULL, NULL, code, 0, NULL, features, FEATURE_INTERPRET_DETECT, feature);
 }
+#endif
 
 #if 0//BUGBUG
 /*! \brief Check if a feature exists */




More information about the asterisk-commits mailing list