[asterisk-commits] rmudgett: branch rmudgett/parking r330996 - in /team/rmudgett/parking: config...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 5 17:24:06 CDT 2011


Author: rmudgett
Date: Fri Aug  5 17:24:02 2011
New Revision: 330996

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=330996
Log:
Add parkext_exclusive configuration option to make parking entry
extensions specify which parking lot they access.

Modified:
    team/rmudgett/parking/configs/features.conf.sample
    team/rmudgett/parking/main/features.c

Modified: team/rmudgett/parking/configs/features.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/parking/configs/features.conf.sample?view=diff&rev=330996&r1=330995&r2=330996
==============================================================================
--- team/rmudgett/parking/configs/features.conf.sample (original)
+++ team/rmudgett/parking/configs/features.conf.sample Fri Aug  5 17:24:02 2011
@@ -3,17 +3,23 @@
 ;
 
 [general]
-parkext => 700			; What extension to dial to park
-parkpos => 701-720		; What extensions to park calls on. (defafult parking lot)
-				; These needs to be numeric, as Asterisk starts from the start position
-				; and increments with one for the next parked call.
-context => parkedcalls		; Which context parked calls are in (default parking lot)
-;parkinghints = no		; Add hints priorities automatically for parking slots (default is no).
-;parkingtime => 45		; Number of seconds a call can be parked for
-				; (default is 45 seconds)
+parkext => 700                  ; What extension to dial to park.  Set per parking lot.
+;parkext_exclusive=yes          ; Specify that the parkext created for this parking lot
+                                ; will only access this parking lot. (default is no)
+parkpos => 701-720              ; What extensions to park calls on. (defafult parking lot)
+                                ; These need to be numeric, as Asterisk starts from the start position
+                                ; and increments with one for the next parked call.
+                                ; Set per parking lot.
+context => parkedcalls          ; Which context parked calls are in (default parking lot)
+                                ; Set per parking lot.
+;parkinghints = no              ; Add hints priorities automatically for parking slots (default is no).
+                                ; Set per parking lot.
+;parkingtime => 45              ; Number of seconds a call can be parked before returning.
+                                ; Set per parking lot. (default is 45 seconds)
 
 ;comebacktoorigin = yes         ; Setting this option configures the behavior of call parking when the
                                 ; parked call times out (See the parkingtime option).  The default value is 'yes'.
+                                ; Operates on all parking lots.
                                 ;
                                 ; 'yes' - When the parked call times out, attempt to send the call back to the peer
                                 ;         that parked this call.  This is done by saving off the name of the channel
@@ -38,46 +44,54 @@
                                 ;         Dial() to 'SIP/0004F2040001'.
                                 ;
 
-;courtesytone = beep		; Sound file to play to when someone picks up a parked call
-				; and also when the Touch Monitor is activated/deactivated.
-				; Default is no tone.
-;parkedplay = caller		; Who to play courtesytone to when picking up a parked call.
-				; One of: parked, caller, both  (default is caller)
+;courtesytone = beep            ; Sound file to play to when someone picks up a parked call
+                                ; and also when the Touch Monitor is activated/deactivated.
+                                ; Default is no tone.
+;parkedplay = caller            ; Who to play courtesytone to when picking up a parked call.
+                                ; One of: parked, caller, both  (default is caller)
+                                ; Operates on all parking lots.
 ;parkedcalltransfers = caller   ; Enables or disables DTMF based transfers when picking up a parked call.
                                 ; one of: callee, caller, both, no (default is no)
+                                ; Set per parking lot.
 ;parkedcallreparking = caller   ; Enables or disables DTMF based parking when picking up a parked call.
                                 ; one of: callee, caller, both, no (default is no)
+                                ; Set per parking lot.
 ;parkedcallhangup = caller      ; Enables or disables DTMF based hangups when picking up a parked call.
                                 ; one of: callee, caller, both, no (default is no)
+                                ; Set per parking lot.
 ;parkedcallrecording = caller   ; Enables or disables DTMF based one-touch recording when picking up a parked call.
                                 ; one of: callee, caller, both, no (default is no)
+                                ; Set per parking lot.
 ;parkeddynamic = yes            ; Enables dynamically created parkinglots. (default is no)
-;adsipark = yes			; if you want ADSI parking announcements
-;parkedmusicclass=default	; This is the MOH class to use for the parked channel
-				; as long as the class is not set on the channel directly
-				; using Set(CHANNEL(musicclass)=whatever) in the dialplan
+                                ; Operates on all parking lots.
+;adsipark = yes                 ; if you want ADSI parking announcements
+                                ; Operates on all parking lots.
+;parkedmusicclass=default       ; This is the MOH class to use for the parked channel
+                                ; as long as the class is not set on the channel directly
+                                ; using Set(CHANNEL(musicclass)=whatever) in the dialplan
+                                ; Set per parking lot.
 
-;transferdigittimeout => 3	; Number of seconds to wait between digits when transferring a call
-				; (default is 3 seconds)
-;xfersound = beep		; to indicate an attended transfer is complete
-;xferfailsound = beeperr	; to indicate a failed transfer
-;pickupexten = *8		; Configure the pickup extension. (default is *8)
-;pickupsound = beep		; to indicate a successful pickup (default: no sound)
-;pickupfailsound = beeperr	; to indicate that the pickup failed (default: no sound)
-;featuredigittimeout = 1000	; Max time (ms) between digits for
-                            ; feature activation  (default is 1000 ms)
-;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.
-                            ; For atxferdropcall=no to work properly, you also need to
-                            ; define ATXFER_NULL_TECH in main/features.c.  The reason the
-                            ; code is not enabled by default is spelled out in the comment
-                            ; block near the top of main/features.c describing ATXFER_NULL_TECH.
-;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.
+;transferdigittimeout => 3      ; Number of seconds to wait between digits when transferring a call
+                                ; (default is 3 seconds)
+;xfersound = beep               ; to indicate an attended transfer is complete
+;xferfailsound = beeperr        ; to indicate a failed transfer
+;pickupexten = *8               ; Configure the pickup extension. (default is *8)
+;pickupsound = beep             ; to indicate a successful pickup (default: no sound)
+;pickupfailsound = beeperr      ; to indicate that the pickup failed (default: no sound)
+;featuredigittimeout = 1000     ; Max time (ms) between digits for
+                                ; feature activation  (default is 1000 ms)
+;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.
+                                ; For atxferdropcall=no to work properly, you also need to
+                                ; define ATXFER_NULL_TECH in main/features.c.  The reason the
+                                ; code is not enabled by default is spelled out in the comment
+                                ; block near the top of main/features.c describing ATXFER_NULL_TECH.
+;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.
 
 ;
 ;*** Define another parking lot
@@ -99,12 +113,12 @@
 
 
 [featuremap]
-;blindxfer => #1		; Blind transfer  (default is #) -- Make sure to set the T and/or t option in the Dial() or Queue() app call!
-;disconnect => *0		; Disconnect  (default is *) -- Make sure to set the H and/or h option in the Dial() or Queue() app call!
-;automon => *1			; One Touch Record a.k.a. Touch Monitor -- Make sure to set the W and/or w option in the Dial() or Queue() app call!
-;atxfer => *2			; Attended transfer  -- Make sure to set the T and/or t option in the Dial() or Queue()  app call!
-;parkcall => #72        ; Park call (one step parking)  -- Make sure to set the K and/or k option in the Dial() app call!
-;automixmon => *3		; One Touch Record a.k.a. Touch MixMonitor -- Make sure to set the X and/or x option in the Dial() or Queue() app call!
+;blindxfer => #1                ; Blind transfer  (default is #) -- Make sure to set the T and/or t option in the Dial() or Queue() app call!
+;disconnect => *0               ; Disconnect  (default is *) -- Make sure to set the H and/or h option in the Dial() or Queue() app call!
+;automon => *1                  ; One Touch Record a.k.a. Touch Monitor -- Make sure to set the W and/or w option in the Dial() or Queue() app call!
+;atxfer => *2                   ; Attended transfer  -- Make sure to set the T and/or t option in the Dial() or Queue()  app call!
+;parkcall => #72                ; Park call (one step parking)  -- Make sure to set the K and/or k option in the Dial() app call!
+;automixmon => *3               ; One Touch Record a.k.a. Touch MixMonitor -- Make sure to set the X and/or x option in the Dial() or Queue() app call!
 
 [applicationmap]
 ; Note that the DYNAMIC_FEATURES channel variable must be set to use the features
@@ -176,7 +190,7 @@
 ;   feature group, add the group name to the value of the DYNAMIC_FEATURES variable.
 ;
 ; example:
-; [myGroupName]        ; defines the group named myGroupName
-; testfeature => #9    ; associates testfeature with the group and the keycode '#9'.
-; pauseMonitor =>      ; associates pauseMonitor with the group and uses the keycode specified
-;                      ; in the [applicationmap].
+; [myGroupName]         ; defines the group named myGroupName
+; testfeature => #9     ; associates testfeature with the group and the keycode '#9'.
+; pauseMonitor =>       ; associates pauseMonitor with the group and uses the keycode specified
+;                       ; in the [applicationmap].

Modified: team/rmudgett/parking/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/parking/main/features.c?view=diff&rev=330996&r1=330995&r2=330996
==============================================================================
--- team/rmudgett/parking/main/features.c (original)
+++ team/rmudgett/parking/main/features.c Fri Aug  5 17:24:02 2011
@@ -411,6 +411,8 @@
 struct parking_dp_ramp {
 	/*! Next node in the parking lot spaces dialplan list. */
 	AST_LIST_ENTRY(parking_dp_ramp) node;
+	/*! TRUE if the parking lot access extension is exclusive. */
+	unsigned int exclusive:1;
 	/*! Parking lot access extension */
 	char exten[1];
 };
@@ -527,6 +529,8 @@
 	 */
 	int parkedcallrecording;
 
+	/*! TRUE if the parking lot is exclusively accessed by parkext */
+	unsigned int parkext_exclusive:1;
 	/*! Add parking hints automatically */
 	unsigned int parkaddhints:1;
 	/*! TRUE if configuration is invalid and the parking lot should not be used. */
@@ -5124,6 +5128,8 @@
 			ast_copy_string(cfg->parking_con, var->value, sizeof(cfg->parking_con));
 		} else if (!strcasecmp(var->name, "parkext")) {
 			ast_copy_string(cfg->parkext, var->value, sizeof(cfg->parkext));
+		} else if (!strcasecmp(var->name, "parkext_exclusive")) {
+			cfg->parkext_exclusive = ast_true(var->value);
 		} else if (!strcasecmp(var->name, "parkinghints")) {
 			cfg->parkaddhints = ast_true(var->value);
 		} else if (!strcasecmp(var->name, "parkedmusicclass")) {
@@ -5206,7 +5212,13 @@
 	char app_data[5 + AST_MAX_CONTEXT];
 
 	/* Create Park option list.  Must match with struct park_app_args options. */
-	snprintf(app_data, sizeof(app_data), ",,,,,%s", parkinglot->name);
+	if (parkinglot->cfg.parkext_exclusive) {
+		/* Specify the parking lot this parking extension parks calls. */
+		snprintf(app_data, sizeof(app_data), ",,,,,%s", parkinglot->name);
+	} else {
+		/* The dialplan must specify which parking lot to use. */
+		app_data[0] = '\0';
+	}
 
 	/* Create context */
 	con = ast_context_find_or_create(NULL, NULL, parkinglot->cfg.parking_con, registrar);
@@ -5231,7 +5243,8 @@
 		/*
 		 * XXX Not sure why we should need to notify the metermaids for
 		 * this exten.  It was originally done for the default parking
-		 * lot entry exten only.
+		 * lot entry exten only but should be done for all entry extens
+		 * if we do it for one.
 		 */
 		/* Notify metermaids about parking lot entry exten state. */
 		notify_metermaids(parkinglot->cfg.parkext, parkinglot->cfg.parking_con,
@@ -5642,11 +5655,12 @@
  * \brief Create a new parking lot ramp dialplan usage node.
  *
  * \param exten Parking lot access ramp extension.
+ * \param exclusive TRUE if the parking lot access ramp extension is exclusive.
  *
  * \retval New usage ramp node on success.
  * \retval NULL on error.
  */
-static struct parking_dp_ramp *build_dialplan_useage_ramp(const char *exten)
+static struct parking_dp_ramp *build_dialplan_useage_ramp(const char *exten, int exclusive)
 {
 	struct parking_dp_ramp *ramp_node;
 
@@ -5654,6 +5668,7 @@
 	if (!ramp_node) {
 		return NULL;
 	}
+	ramp_node->exclusive = exclusive;
 	strcpy(ramp_node->exten, exten);
 	return ramp_node;
 }
@@ -5664,17 +5679,23 @@
  *
  * \param ramp_map Current parking lot context ramp usage map.
  * \param exten Parking lot access ramp extension to add.
+ * \param exclusive TRUE if the parking lot access ramp extension is exclusive.
  * \param lot Parking lot supplying reference data.
  * \param complain TRUE if to complain of parking lot ramp conflicts.
  *
  * \retval 0 on success.  The ramp_map is updated.
  * \retval -1 on failure.
  */
-static int usage_context_add_ramp(struct parking_dp_ramp_map *ramp_map, const char *exten, struct ast_parkinglot *lot, int complain)
+static int usage_context_add_ramp(struct parking_dp_ramp_map *ramp_map, const char *exten, int exclusive, struct ast_parkinglot *lot, int complain)
 {
 	struct parking_dp_ramp *cur_ramp;
 	struct parking_dp_ramp *new_ramp;
 	int cmp;
+
+	/* Make sure that exclusive is only 0 or 1 */
+	if (exclusive) {
+		exclusive = 1;
+	}
 
 	AST_LIST_TRAVERSE_SAFE_BEGIN(ramp_map, cur_ramp, node) {
 		cmp = strcmp(exten, cur_ramp->exten);
@@ -5684,7 +5705,7 @@
 		}
 		if (cmp == 0) {
 			/* The ramp is already in the map. */
-			if (complain) {
+			if (complain && (cur_ramp->exclusive || exclusive)) {
 				ast_log(LOG_WARNING,
 					"Parking lot '%s' parkext %s@%s used by another parking lot.\n",
 					lot->name, exten, lot->cfg.parking_con);
@@ -5692,7 +5713,7 @@
 			return 0;
 		}
 		/* The new parking lot ramp goes before this node. */
-		new_ramp = build_dialplan_useage_ramp(exten);
+		new_ramp = build_dialplan_useage_ramp(exten, exclusive);
 		if (!new_ramp) {
 			return -1;
 		}
@@ -5702,7 +5723,7 @@
 	AST_LIST_TRAVERSE_SAFE_END;
 
 	/* New parking lot access ramp goes on the end. */
-	new_ramp = build_dialplan_useage_ramp(exten);
+	new_ramp = build_dialplan_useage_ramp(exten, exclusive);
 	if (!new_ramp) {
 		return -1;
 	}
@@ -5851,8 +5872,8 @@
  */
 static int dialplan_usage_add_parkinglot_data(struct parking_dp_context *ctx_node, struct ast_parkinglot *lot, int complain)
 {
-	if (usage_context_add_ramp(&ctx_node->access_extens, lot->cfg.parkext, lot,
-		complain)) {
+	if (usage_context_add_ramp(&ctx_node->access_extens, lot->cfg.parkext,
+		lot->cfg.parkext_exclusive, lot, complain)) {
 		return -1;
 	}
 	if (usage_context_add_spaces(&ctx_node->spaces, lot->cfg.parking_start,
@@ -7475,6 +7496,7 @@
 		return -1;
 	}
 	ast_copy_string(lot->cfg.parking_con, "test-ctx", sizeof(lot->cfg.parking_con));
+	lot->cfg.parkext_exclusive = 1;
 
 	ast_test_status_update(test,
 		"Build old_ctx map\n");




More information about the asterisk-commits mailing list