[svn-commits] dvossel: branch russell/ast_channel_ao2 r189949 - in /team/russell/ast_channe...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Apr 22 11:46:04 CDT 2009


Author: dvossel
Date: Wed Apr 22 11:46:01 2009
New Revision: 189949

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=189949
Log:
Fixed issues involving DAHDIScan's integration into app_chanspy.

Modified:
    team/russell/ast_channel_ao2/UPGRADE.txt
    team/russell/ast_channel_ao2/apps/app_chanspy.c

Modified: team/russell/ast_channel_ao2/UPGRADE.txt
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/UPGRADE.txt?view=diff&rev=189949&r1=189948&r2=189949
==============================================================================
--- team/russell/ast_channel_ao2/UPGRADE.txt (original)
+++ team/russell/ast_channel_ao2/UPGRADE.txt Wed Apr 22 11:46:01 2009
@@ -27,7 +27,7 @@
   will not be able to send or receive calls.
 * The app_dahdiscan.c file has been removed, but the dialplan app DAHDIScan still 
   remains. It now exists within app_chanspy.c and retains the exact same 
-  functaionlity as before. 
+  functionality as before. 
 
 From 1.6.1 to 1.6.2:
 

Modified: team/russell/ast_channel_ao2/apps/app_chanspy.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/apps/app_chanspy.c?view=diff&rev=189949&r1=189948&r2=189949
==============================================================================
--- team/russell/ast_channel_ao2/apps/app_chanspy.c (original)
+++ team/russell/ast_channel_ao2/apps/app_chanspy.c Wed Apr 22 11:46:01 2009
@@ -970,7 +970,11 @@
 	char *recbase = NULL;
 	int fd = 0;
 	struct ast_flags flags;
-	struct spy_dtmf_options user_options;
+	struct spy_dtmf_options user_options = {
+		.cycle = '*',
+		.volume = '#',
+		.exit = '\0',
+	};
 	int oldwf = 0;
 	int volfactor = 0;
 	int res;
@@ -982,10 +986,6 @@
 	);
 	char *opts[OPT_ARG_ARRAY_SIZE];
 
-	user_options.cycle = '*';
-	user_options.volume = '#';
-	user_options.exit = '\0';
-
 	data = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, data);
 
@@ -1004,7 +1004,7 @@
 
 		if (ast_test_flag(&flags, OPTION_DTMF_EXIT) && opts[OPT_ARG_EXIT]) {
 			tmp = opts[OPT_ARG_EXIT][0];
-			if (tmp >= '0' || tmp <= '9' || tmp == '#' || tmp == '*') {
+			if (strchr("0123456789*#", tmp) && tmp != '\0') {
 				user_options.exit = tmp;
 			} else {
 				ast_log(LOG_NOTICE, "Argument for option 'x' must be a valid DTMF digit.");
@@ -1013,7 +1013,7 @@
 
 		if (ast_test_flag(&flags, OPTION_DTMF_CYCLE) && opts[OPT_ARG_CYCLE]) {
 			tmp = opts[OPT_ARG_CYCLE][0];
-			if (tmp >= '0' || tmp <= '9' || tmp == '#' || tmp == '*') {
+			if (strchr("0123456789*#", tmp) && tmp != '\0') {
 				user_options.cycle = tmp;
 			} else {
 				ast_log(LOG_NOTICE, "Argument for option 'c' must be a valid DTMF digit.");
@@ -1085,7 +1085,11 @@
 	char *recbase = NULL;
 	int fd = 0;
 	struct ast_flags flags;
-	struct spy_dtmf_options user_options;
+	struct spy_dtmf_options user_options = {
+		.cycle = '*',
+		.volume = '#',
+		.exit = '\0',
+	};
 	int oldwf = 0;
 	int volfactor = 0;
 	int res;
@@ -1096,10 +1100,6 @@
 		AST_APP_ARG(options);
 	);
 
-	user_options.cycle = '*';
-	user_options.volume = '#';
-	user_options.exit = '\0';
-
 	data = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, data);
@@ -1114,6 +1114,7 @@
 
 	if (args.options) {
 		char *opts[OPT_ARG_ARRAY_SIZE];
+		char tmp;
 
 		ast_app_parse_options(spy_opts, &flags, opts, args.options);
 		if (ast_test_flag(&flags, OPTION_GROUP))
@@ -1122,6 +1123,24 @@
 		if (ast_test_flag(&flags, OPTION_RECORD) &&
 			!(recbase = opts[OPT_ARG_RECORD]))
 			recbase = "chanspy";
+
+		if (ast_test_flag(&flags, OPTION_DTMF_EXIT) && opts[OPT_ARG_EXIT]) {
+			tmp = opts[OPT_ARG_EXIT][0];
+			if (strchr("0123456789*#", tmp) && tmp != '\0') {
+				user_options.exit = tmp;
+			} else {
+				ast_log(LOG_NOTICE, "Argument for option 'x' must be a valid DTMF digit.");
+			}
+		}
+
+		if (ast_test_flag(&flags, OPTION_DTMF_CYCLE) && opts[OPT_ARG_CYCLE]) {
+			tmp = opts[OPT_ARG_CYCLE][0];
+			if (strchr("0123456789*#", tmp) && tmp != '\0') {
+				user_options.cycle = tmp;
+			} else {
+				ast_log(LOG_NOTICE, "Argument for option 'c' must be a valid DTMF digit.");
+			}
+		}
 
 		if (ast_test_flag(&flags, OPTION_VOLUME) && opts[OPT_ARG_VOLUME]) {
 			int vol;
@@ -1184,14 +1203,14 @@
 {
 	const char *spec = "DAHDI";
 	struct ast_flags flags;
-	struct spy_dtmf_options user_options;
+	struct spy_dtmf_options user_options = {
+		.cycle = '#',
+		.volume = '\0',
+		.exit = '*',
+	};
 	int oldwf = 0;
 	int res;
 	char *mygroup = NULL;
-
-	user_options.cycle = '#';
-	user_options.volume = '\0';
-	user_options.exit = '*';
 
 	ast_clear_flag(&flags, AST_FLAGS_ALL);
 




More information about the svn-commits mailing list