[asterisk-commits] russell: branch russell/issue_8413 r62543 - /team/russell/issue_8413/res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 1 13:26:37 MST 2007


Author: russell
Date: Tue May  1 15:26:37 2007
New Revision: 62543

URL: http://svn.digium.com/view/asterisk?view=rev&rev=62543
Log:
a few minor cleanups

Modified:
    team/russell/issue_8413/res/res_features.c

Modified: team/russell/issue_8413/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/russell/issue_8413/res/res_features.c?view=diff&rev=62543&r1=62542&r2=62543
==============================================================================
--- team/russell/issue_8413/res/res_features.c (original)
+++ team/russell/issue_8413/res/res_features.c Tue May  1 15:26:37 2007
@@ -63,6 +63,8 @@
 #define DEFAULT_TRANSFER_DIGIT_TIMEOUT 3000
 #define DEFAULT_FEATURE_DIGIT_TIMEOUT 500
 #define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER 15000
+#define DEFAULT_ATXFER_DROP_CALL 0
+#define DEFAULT_ATXFER_LOOP_DELAY 10000
 
 #define AST_MAX_WATCHERS 256
 
@@ -827,7 +829,6 @@
 	newchan = ast_feature_request_and_dial(transferer, transferee, "Local", ast_best_codec(transferer->nativeformats),
 		xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1);
 
-
 	if (!ast_check_hangup(transferer)) {
 		/* Transferer is up - old behaviour */
 		ast_indicate(transferer, -1);
@@ -886,8 +887,7 @@
 		newchan->_state = AST_STATE_UP;
 		ast_clear_flag(newchan, AST_FLAGS_ALL);
 		newchan->_softhangup = 0;
-		tobj = ast_calloc(1, sizeof(struct ast_bridge_thread_obj));
-		if (!tobj) {
+		if (!(tobj = ast_calloc(1, sizeof(*tobj)))) {
 			ast_hangup(xferchan);
 			ast_hangup(newchan);
 			return -1;
@@ -975,8 +975,7 @@
 		newchan->_state = AST_STATE_UP;
 		ast_clear_flag(newchan, AST_FLAGS_ALL);
 		newchan->_softhangup = 0;
-		tobj = ast_calloc(1, sizeof(struct ast_bridge_thread_obj));
-		if (!tobj) {
+		if (!(tobj = ast_calloc(1, sizeof(*tobj)))) {
 			ast_hangup(xferchan);
 			ast_hangup(newchan);
 			return -1;
@@ -991,15 +990,14 @@
 		return -1;      /* XXX meaning the channel is bridged ? */
 
 	} else {
-		/* Transferee hanged up */
+		/* Transferee hung up */
 		finishup(transferee);
 		return -1;
 	}
 }
 
-
 /* add atxfer and automon as undefined so you can only use em if you configure them */
-#define FEATURES_COUNT (sizeof(builtin_features) / sizeof(builtin_features[0]))
+#define FEATURES_COUNT ARRAY_LEN(builtin_features)
 
 struct ast_call_feature builtin_features[] = 
  {
@@ -2446,8 +2444,8 @@
 	transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
 	featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
 	atxfernoanswertimeout = DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER;
-	atxferloopdelay = 10000;
-	atxferdropcall = 0;
+	atxferloopdelay = DEFAULT_ATXFER_LOOP_DELAY;
+	atxferdropcall = DEFAULT_ATXFER_DROP_CALL;
 
 	cfg = ast_config_load("features.conf");
 	if (!cfg) {
@@ -2512,13 +2510,11 @@
 		} else if (!strcasecmp(var->name, "atxferloopdelay")) {
 			if ((sscanf(var->value, "%d", &atxferloopdelay) != 1) || (atxferloopdelay < 1)) {
 				ast_log(LOG_WARNING, "%s is not a valid atxferloopdelay\n", var->value);
-				atxferloopdelay = 10000;
+				atxferloopdelay = DEFAULT_ATXFER_LOOP_DELAY;
 			} else 
-				atxferloopdelay = atxferloopdelay * 1000;
+				atxferloopdelay *= 1000;
 		} else if (!strcasecmp(var->name, "atxferdropcall")) {
-			if (ast_true(var->value)) {
-				atxferdropcall = 1;
-			}
+			atxferdropcall = ast_true(var->value);
 		} else if (!strcasecmp(var->name, "courtesytone")) {
 			ast_copy_string(courtesytone, var->value, sizeof(courtesytone));
 		}  else if (!strcasecmp(var->name, "parkedplay")) {



More information about the asterisk-commits mailing list