[asterisk-commits] russell: branch russell/issue_8413 r62577 - in /team/russell/issue_8413: conf...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 1 15:11:16 MST 2007


Author: russell
Date: Tue May  1 17:11:16 2007
New Revision: 62577

URL: http://svn.digium.com/view/asterisk?view=rev&rev=62577
Log:
make the number of retries configurable and clarify some docs

Modified:
    team/russell/issue_8413/configs/features.conf.sample
    team/russell/issue_8413/res/res_features.c

Modified: team/russell/issue_8413/configs/features.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/issue_8413/configs/features.conf.sample?view=diff&rev=62577&r1=62576&r2=62577
==============================================================================
--- team/russell/issue_8413/configs/features.conf.sample (original)
+++ team/russell/issue_8413/configs/features.conf.sample Tue May  1 17:11:16 2007
@@ -33,9 +33,14 @@
 ;pickupexten = *8		; Configure the pickup extension. (default is *8)
 ;featuredigittimeout = 500	; Max time (ms) between digits for 
 				; feature activation  (default is 500 ms)
-;atxfernoanswertimeout = 15	; Timeout for answer on attended transfer default is 15 seconds.
-;atxferdropcall = false		; Drop call after failed callback, by default system will try to transfer again.
-;atxferloopdelay = 10		; Number of seconds to sleep between loops (if atxferdropcall = false)
+;atxfernoanswertimeout = 15 ; Timeout for answer on attended transfer default is 15 seconds.
+;atxferdropcall = no        ; If someone does an attended transfer, then hangs up before the transferred
+                            ; caller is connected, then by default, the system will try to call back the
+                            ; person that did the transfer.  If this is set to "yes", the callback will
+                            ; not be attempted and the transfer will just fail.
+;atxferloopdelay = 10       ; Number of seconds to sleep between retries (if atxferdropcall = no)
+;atxfercallbackretries = 2  ; Number of times to attempt to send the call back to the transferer.
+                            ; By default, this is 2.
 
 [featuremap]
 ;blindxfer => #1		; Blind transfer  (default is #)

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=62577&r1=62576&r2=62577
==============================================================================
--- team/russell/issue_8413/res/res_features.c (original)
+++ team/russell/issue_8413/res/res_features.c Tue May  1 17:11:16 2007
@@ -65,6 +65,7 @@
 #define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER 15000
 #define DEFAULT_ATXFER_DROP_CALL 0
 #define DEFAULT_ATXFER_LOOP_DELAY 10000
+#define DEFAULT_ATXFER_CALLBACK_RETRIES 2
 
 #define AST_MAX_WATCHERS 256
 
@@ -106,8 +107,9 @@
 static int comebacktoorigin = 1;
 
 static int atxfernoanswertimeout;
-static int atxferdropcall;
-static int atxferloopdelay;
+static unsigned int atxferdropcall;
+static unsigned int atxferloopdelay;
+static unsigned int atxfercallbackretries;
 
 static char *registrar = "res_features";		   /*!< Registrar for operations */
 
@@ -921,7 +923,7 @@
 
 			newchan = ast_feature_request_and_dial(transferee, NULL, "Local", ast_best_codec(transferee->nativeformats),
 				callbackto, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
-			while (!newchan && !atxferdropcall && tries < 2) {
+			while (!newchan && !atxferdropcall && tries < atxfercallbackretries) {
 				/* Trying to transfer again */
 				ast_autoservice_start(transferee);
 				ast_indicate(transferee, AST_CONTROL_HOLD);
@@ -992,7 +994,6 @@
 			ast_log(LOG_WARNING, "Failed to play transfer sound!\n");
 		ast_bridge_call_thread_launch(tobj);
 		return -1;      /* XXX meaning the channel is bridged ? */
-
 	} else {
 		/* Transferee hung up */
 		finishup(transferee);
@@ -2450,6 +2451,7 @@
 	atxfernoanswertimeout = DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER;
 	atxferloopdelay = DEFAULT_ATXFER_LOOP_DELAY;
 	atxferdropcall = DEFAULT_ATXFER_DROP_CALL;
+	atxfercallbackretries = DEFAULT_ATXFER_CALLBACK_RETRIES;
 
 	cfg = ast_config_load("features.conf");
 	if (!cfg) {
@@ -2512,13 +2514,18 @@
 			} else
 				atxfernoanswertimeout = atxfernoanswertimeout * 1000;
 		} else if (!strcasecmp(var->name, "atxferloopdelay")) {
-			if ((sscanf(var->value, "%d", &atxferloopdelay) != 1) || (atxferloopdelay < 1)) {
+			if ((sscanf(var->value, "%u", &atxferloopdelay) != 1)) {
 				ast_log(LOG_WARNING, "%s is not a valid atxferloopdelay\n", var->value);
 				atxferloopdelay = DEFAULT_ATXFER_LOOP_DELAY;
 			} else 
 				atxferloopdelay *= 1000;
 		} else if (!strcasecmp(var->name, "atxferdropcall")) {
 			atxferdropcall = ast_true(var->value);
+		} else if (!strcasecmp(var->name, "atxfercallbackretries")) {
+			if ((sscanf(var->value, "%u", &atxferloopdelay) != 1)) {
+				ast_log(LOG_WARNING, "%s is not a valid atxfercallbackretries\n", var->value);
+				atxfercallbackretries = DEFAULT_ATXFER_CALLBACK_RETRIES;
+			}
 		} 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