Index: main/features.c
===================================================================
--- main/features.c	(revision 284848)
+++ main/features.c	(working copy)
@@ -296,6 +296,7 @@
 #define DEFAULT_ATXFER_DROP_CALL 0
 #define DEFAULT_ATXFER_LOOP_DELAY 10000
 #define DEFAULT_ATXFER_CALLBACK_RETRIES 2
+#define DEFAULT_COMEBACK_DIAL_TIME 30
 
 #define AST_MAX_WATCHERS 256
 #define MAX_DIAL_FEATURE_OPTIONS 30
@@ -380,6 +381,8 @@
 static int transferdigittimeout;
 static int featuredigittimeout;
 static int comebacktoorigin = 1;
+static int comebacktocustom = 0;
+static int comebackdialtime;
 
 static int atxfernoanswertimeout;
 static unsigned int atxferdropcall;
@@ -3665,19 +3668,25 @@
 
 					if (dialfeatures) {
 						char buf[MAX_DIAL_FEATURE_OPTIONS] = {0,};
-						snprintf(returnexten, sizeof(returnexten), "%s,30,%s", peername, callback_dialoptions(&(dialfeatures->features_callee), &(dialfeatures->features_caller), buf, sizeof(buf)));
+						snprintf(returnexten, sizeof(returnexten), "%s,%d,%s", peername, comebackdialtime, callback_dialoptions(&(dialfeatures->features_callee), &(dialfeatures->features_caller), buf, sizeof(buf)));
 					} else { /* Existing default */
 						ast_log(LOG_NOTICE, "Dial features not found on %s, using default!\n", chan->name);
-						snprintf(returnexten, sizeof(returnexten), "%s,30,t", peername);
+						snprintf(returnexten, sizeof(returnexten), "%s,%d,t", peername, comebackdialtime);
 					}
 
+					pbx_builtin_setvar_helper(chan, "PARKER", peername);
+					snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
+					pbx_builtin_setvar_helper(chan, "PARKINGSLOT", parkingslot);
+
 					ast_add_extension2(con, 1, peername_flat, 1, NULL, NULL, "Dial", ast_strdup(returnexten), ast_free_ptr, registrar);
 				}
 				if (pu->options_specified == 1) {
 					/* Park() was called with overriding return arguments, respect those arguments */
 					set_c_e_p(chan, pu->context, pu->exten, pu->priority);
 				} else {
-					if (comebacktoorigin) {
+					if ((comebacktocustom) && (ast_exists_extension(chan, pu->parkinglot->parking_con, "s", 1, NULL))) {
+						set_c_e_p(chan, pu->parkinglot->parking_con, "s", 1);
+					} else if (comebacktoorigin) {
 						set_c_e_p(chan, pu->parkinglot->parking_con_dial, peername_flat, 1);
 					} else {
 						snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
@@ -4400,6 +4409,7 @@
 	pickupfailsound[0] = '\0';
 	adsipark = 0;
 	comebacktoorigin = 1;
+	comebacktocustom = 0;
 	parkeddynamic = 0;
 
 	default_parkinglot->parkaddhints = 0;
@@ -4414,6 +4424,7 @@
 	atxferloopdelay = DEFAULT_ATXFER_LOOP_DELAY;
 	atxferdropcall = DEFAULT_ATXFER_DROP_CALL;
 	atxfercallbackretries = DEFAULT_ATXFER_CALLBACK_RETRIES;
+	comebackdialtime = DEFAULT_COMEBACK_DIAL_TIME;
 
 	cfg = ast_config_load2("features.conf", "features", config_flags);
 	if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {
@@ -4506,6 +4517,11 @@
 				ast_log(LOG_WARNING, "%s is not a valid atxfercallbackretries\n", var->value);
 				atxfercallbackretries = DEFAULT_ATXFER_CALLBACK_RETRIES;
 			}
+		} else if (!strcasecmp(var->name, "comebackdialtime")) {
+			if ((sscanf(var->value, "%30d", &comebackdialtime) != 1) || (comebackdialtime < 1)) {
+				ast_log(LOG_WARNING, "%s is not a valid comebackdialtime\n", var->value);
+				comebackdialtime = DEFAULT_COMEBACK_DIAL_TIME;
+			}
 		} else if (!strcasecmp(var->name, "courtesytone")) {
 			ast_copy_string(courtesytone, var->value, sizeof(courtesytone));
 		}  else if (!strcasecmp(var->name, "parkedplay")) {
@@ -4527,6 +4543,8 @@
 			ast_copy_string(pickupfailsound, var->value, sizeof(pickupfailsound));
 		} else if (!strcasecmp(var->name, "comebacktoorigin")) {
 			comebacktoorigin = ast_true(var->value);
+		} else if (!strcasecmp(var->name, "comebacktocustom")) {
+			comebacktocustom = ast_true(var->value);
 		} else if (!strcasecmp(var->name, "parkedmusicclass")) {
 			ast_copy_string(default_parkinglot->mohclass, var->value, sizeof(default_parkinglot->mohclass));
 		}
Index: configs/features.conf.sample
===================================================================
--- configs/features.conf.sample	(revision 284848)
+++ configs/features.conf.sample	(working copy)
@@ -38,6 +38,46 @@
                                 ;         Dial() to 'SIP/0004F2040001'.
                                 ;
 
+;comebacktocustom = yes		; Setting this option gives you more control over what happens when the parked
+				; call times out.  This primarily helps users get more control of calls parked
+				; using one touch parking.  The default value is 'no'
+				;
+				; 'yes' - When the parked call times out, attempt to send the call to the parking lot
+				;         context at extension 's', priority '1'.  The channel variable PARKER is
+				;         set to the device that originally parked the call.  The channel variable
+				;         PARKINGSLOT is set to the parking slot number the channel just expired
+				;         out of.  This allows you to change the callerid or set a different ring
+				;         tone and then send the call back to the original device that parked the
+				;         call.
+				;
+				;         Setting this to 'yes' overrides comebacktoorigin.
+				;
+				;         The user must create the dialplan in the parking lot context for
+				;         extension 's'.  This is not done dynamically.
+				;
+				;         If the parking lot context at extension 's', priority '1' does not exist,
+				;         this option is ignored and it is as if the option was set to no.  This
+				;         check occurs on a per-call basis.
+				;
+				;         Sample dialplan:
+				;         [park-lot1]
+				;         exten => s,1,DumpChan()
+				;         exten => s,n,ExecIf($["${OriginalCIDName}" = ""]?Set(OriginalCIDName=${CALLERID(name)})
+				;         exten => s,n,Set(CALLERID(name)=P${PARKINGSLOT}:${OriginalCIDName})
+				;         exten => s,n,Dial(${PARKER},30,TKtwk)
+				;         exten => s,n,ExecIf($["${DIALSTATUS}" = "ANSWER"]?Hangup())
+				;         exten => s,n,Goto(incoming,s,reception)
+				;
+				; 'no'  - When the parked call times out, handle the call as usual.
+				;
+				;         The normal behavior using one touch parking is to Dial the device that
+				;         originally parked the call for comebackdialtime seconds.  If the call is
+				;         not picked up, the call terminates.
+				;
+
+;comebackdialtime = 30		; Allows the user to set how long a one touch parked call will ring back to the original
+				; parking device before the call terminates
+
 ;courtesytone = beep		; Sound file to play to the parked caller
 				; when someone dials a parked call
 				; or the Touch Monitor is activated/deactivated.
