[Asterisk-cvs] asterisk/res res_features.c,1.27,1.28

markster at lists.digium.com markster at lists.digium.com
Wed Jan 5 15:26:51 CST 2005


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv20379/res

Modified Files:
	res_features.c 
Log Message:
Various/assundry cleanups


Index: res_features.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_features.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- res_features.c	5 Jan 2005 21:00:20 -0000	1.27
+++ res_features.c	5 Jan 2005 21:31:40 -0000	1.28
@@ -60,6 +60,11 @@
 
 static char pickup_ext[AST_MAX_EXTENSION] = "*8";
 
+/* Default sounds */
+static char courtesytone[256] = "";
+static char xfersound[256] = "beep";
+static char xferfailsound[256] = "pbx-invalid";
+
 /* First available extension for parking */
 static int parking_start = 701;
 
@@ -72,12 +77,6 @@
 static int featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
 
 /* Default courtesy tone played when party joins conference */
-static char courtesytone[256] = "";
-
-/* Default sounds */
-static char xfersound[256] = "beep";
-static char xferfailsound[256] = "beeperr";
-
 
 /* Registrar for operations */
 static char *registrar = "res_features";
@@ -496,7 +495,10 @@
 		if (option_verbose > 2)	
 			ast_verbose(VERBOSE_PREFIX_3 "Unable to find extension '%s' in context '%s'\n", newext, transferer_real_context);
 	}
-	res = ast_streamfile(transferer, xferfailsound, transferee->language);
+	if (!ast_strlen_zero(xferfailsound))
+		res = ast_streamfile(transferer, xferfailsound, transferee->language);
+	else
+		res = 0;
 	if (res) {
 		ast_moh_stop(transferee);
 		ast_autoservice_stop(transferee);
@@ -585,7 +587,7 @@
 					}
 					if (!ast_strlen_zero(xfersound) && !ast_streamfile(transferer, xfersound, transferer->language)) {
 						if (ast_waitstream(transferer, "") < 0) {
-							ast_log(LOG_WARNING, "Failed to play %s\n", xfersound);
+							ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
 						}
 					}
 					ast_moh_stop(transferee);
@@ -648,7 +650,7 @@
 	
 					if (!ast_strlen_zero(xfersound) && !ast_streamfile(newchan, xfersound, newchan->language)) {
 						if (ast_waitstream(newchan, "") < 0) {
-							ast_log(LOG_WARNING, "Failed to play %s!\n", xfersound);
+							ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
 						}
 					}
 					ast_bridge_call_thread_launch(tobj);
@@ -663,7 +665,7 @@
 				ast_log(LOG_WARNING, "Unable to create channel Local/%s do you have chan_local?\n",dialstr);
 				ast_moh_stop(transferee);
 				ast_autoservice_stop(transferee);
-				if(!ast_strlen_zero(xferfailsound)) {
+				if (!ast_strlen_zero(xferfailsound)) {
 					res = ast_streamfile(transferer, xferfailsound, transferer->language);
 					if (!res && (ast_waitstream(transferer, "") < 0)) {
 						return -1;
@@ -675,20 +677,16 @@
 			ast_log(LOG_WARNING, "Extension %s does not exist in context %s\n",xferto,transferer_real_context);
 			ast_moh_stop(transferee);
 			ast_autoservice_stop(transferee);
-			if(!ast_strlen_zero(xferfailsound)) {
-				res = ast_streamfile(transferer, xferfailsound, transferer->language);
-				if (!res && (ast_waitstream(transferer, "") < 0)) {
-					return -1;
-				}
+			res = ast_streamfile(transferer, "beeperr", transferer->language);
+			if (!res && (ast_waitstream(transferer, "") < 0)) {
+				return -1;
 			}
 		}
 	}  else {
 		ast_log(LOG_WARNING, "Did not read data.\n");
-		if(!ast_strlen_zero(xferfailsound)) {
-			res = ast_streamfile(transferer, xferfailsound, transferer->language);
-			if (ast_waitstream(transferer, "") < 0) {
-				return -1;
-			}
+		res = ast_streamfile(transferer, "beeperr", transferer->language);
+		if (ast_waitstream(transferer, "") < 0) {
+			return -1;
 		}
 	}
 	ast_moh_stop(transferee);
@@ -1413,13 +1411,13 @@
 					featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
 				}
 			} else if (!strcasecmp(var->name, "courtesytone")) {
-				strncpy(courtesytone, strcmp(var->value, "undef") ? var->value : "", sizeof(courtesytone) - 1);
+				strncpy(courtesytone, var->value, sizeof(courtesytone) - 1);
 			} else if (!strcasecmp(var->name, "xfersound")) {
-				strncpy(xfersound, strcmp(var->value, "undef") ? var->value : "", sizeof(xfersound) - 1);
+				strncpy(xfersound, var->value, sizeof(xfersound) - 1);
 			} else if (!strcasecmp(var->name, "xferfailsound")) {
-				strncpy(xferfailsound, strcmp(var->value, "undef") ? var->value : "", sizeof(xferfailsound) - 1);
+				strncpy(xferfailsound, var->value, sizeof(xferfailsound) - 1);
 			} else if (!strcasecmp(var->name, "pickupexten")) {
-				strncpy(pickup_ext, strcmp(var->value, "undef") ? var->value : "", sizeof(pickup_ext) - 1);
+				strncpy(pickup_ext, var->value, sizeof(pickup_ext) - 1);
 			}
 			var = var->next;
 		}




More information about the svn-commits mailing list