diff options
-rw-r--r-- | UPGRADE.txt | 11 | ||||
-rw-r--r-- | configs/samples/res_parking.conf.sample | 42 | ||||
-rw-r--r-- | main/core_unreal.c | 4 | ||||
-rw-r--r-- | res/parking/parking_applications.c | 45 | ||||
-rw-r--r-- | res/parking/parking_bridge_features.c | 18 | ||||
-rw-r--r-- | res/parking/res_parking.h | 5 | ||||
-rw-r--r-- | res/res_parking.c | 78 |
7 files changed, 170 insertions, 33 deletions
diff --git a/UPGRADE.txt b/UPGRADE.txt index 471350c5a..4f40b2b9d 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -21,6 +21,17 @@ === UPGRADE-12.txt -- Upgrade info for 11 to 12 =========================================================== +From 13.8.0 to 13.9.0: + +res_parking: + - The dynamic parking lot creation channel variables PARKINGDYNAMIC, + PARKINGDYNCONTEXT, PARKINGDYNEXTEN, and PARKINGDYNPOS are now looked + for in the parker's channel instead of the parked channel. This is only + of significance if the parker uses blind transfer or the DTMF one-step + parking feature. You need to use the double underscore '__' inheritance + for these variables. The indefinite inheritance is also recommended + for the PARKINGEXTEN variable. + From 13.7.0 to 13.8.0: res_pjsip: diff --git a/configs/samples/res_parking.conf.sample b/configs/samples/res_parking.conf.sample index d24be2039..e13f780e0 100644 --- a/configs/samples/res_parking.conf.sample +++ b/configs/samples/res_parking.conf.sample @@ -1,5 +1,43 @@ [general] ;parkeddynamic = yes ; Enables dynamically created parkinglots. (default is no) + ; If the option is enabled then the following + ; variables can be used to dynamically create + ; new parking lots. + ; + ; The PARKINGDYNAMIC variable specifies the + ; parking lot to use as a template to create + ; a dynamic parking lot. It is an error to + ; specify a non-existent parking lot for the + ; template. If not set then the default + ; parking lot is used as the template. + ; + ; The PARKINGDYNCONTEXT variable specifies + ; the dialplan context to use for the newly + ; created dynamic parking lot. If not set + ; then the context from the parking lot + ; template is used. The context is created + ; if it does not already exist and the new + ; parking lot needs to create extensions. + ; + ; The PARKINGDYNEXTEN variable specifies the + ; parkext to use for the newly created dynamic + ; parking lot. If not set then the parkext + ; is used from the parking lot template. If + ; the template does not specify a parkext + ; then no extensions are created for the + ; newly created parking lot. The dynamic + ; parking lot cannot be created if it needs + ; to create extensions that overlap existing + ; parking lot extensions. The only exception + ; to this is for the parkext extension and + ; only if neither of the overlaping parking + ; lot's parkext is exclusive. + ; + ; The PARKINGDYNPOS variable specifies the + ; parking positions to use for the newly + ; created dynamic parking lot. If not set + ; then the parkpos from the parking lot + ; template is used. ; A parking lot named 'default' will automatically be used when no other ; named parking lot is indicated for use by the park application or a @@ -11,6 +49,10 @@ parkext => 700 ; What extension to dial to park. (optional; if ; specified, extensions will be created for parkext and ; the whole range of parkpos) + ; + ; Note: Generated parking extensions cannot overlap. + ; The only exception is if neither overlapping parkext + ; is exclusive. ;parkext_exclusive=yes ; Specify that the parkext created for this parking lot ; will only access this parking lot. (default is no) diff --git a/main/core_unreal.c b/main/core_unreal.c index d57e01f18..028e371f6 100644 --- a/main/core_unreal.c +++ b/main/core_unreal.c @@ -687,13 +687,13 @@ void ast_unreal_call_setup(struct ast_channel *semi1, struct ast_channel *semi2) ast_connected_line_copy_from_caller(ast_channel_connected(semi2), ast_channel_caller(semi1)); ast_channel_language_set(semi2, ast_channel_language(semi1)); + ast_channel_musicclass_set(semi2, ast_channel_musicclass(semi1)); + ast_channel_parkinglot_set(semi2, ast_channel_parkinglot(semi1)); /* Crossover the accountcode and peeraccount to cross the unreal bridge. */ ast_channel_accountcode_set(semi2, ast_channel_peeraccount(semi1)); ast_channel_peeraccount_set(semi2, ast_channel_accountcode(semi1)); - ast_channel_musicclass_set(semi2, ast_channel_musicclass(semi1)); - ast_channel_cc_params_init(semi2, ast_channel_get_cc_config_params(semi1)); /* diff --git a/res/parking/parking_applications.c b/res/parking/parking_applications.c index 1bdb50fab..99999c9e2 100644 --- a/res/parking/parking_applications.c +++ b/res/parking/parking_applications.c @@ -90,6 +90,47 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") call on that extension. If the extension is already in use then execution will continue at the next priority. </para> + <para>If the <literal>parkeddynamic</literal> option is enabled in + <filename>res_parking.conf</filename> the following variables can be + used to dynamically create new parking lots. When using dynamic parking + lots, be aware of the conditions as explained in the notes section + below. + </para> + <para>The <variable>PARKINGDYNAMIC</variable> variable specifies the + parking lot to use as a template to create a dynamic parking lot. It + is an error to specify a non-existent parking lot for the template. + If not set then the default parking lot is used as the template. + </para> + <para>The <variable>PARKINGDYNCONTEXT</variable> variable specifies the + dialplan context to use for the newly created dynamic parking lot. If + not set then the context from the parking lot template is used. The + context is created if it does not already exist and the new parking lot + needs to create extensions. + </para> + <para>The <variable>PARKINGDYNEXTEN</variable> variable specifies the + <literal>parkext</literal> to use for the newly created dynamic + parking lot. If not set then the <literal>parkext</literal> is used from + the parking lot template. If the template does not specify a + <literal>parkext</literal> then no extensions are created for the newly + created parking lot. The dynamic parking lot cannot be created if it + needs to create extensions that overlap existing parking lot extensions. + The only exception to this is for the <literal>parkext</literal> + extension and only if neither of the overlaping parking lot's + <literal>parkext</literal> is exclusive. + </para> + <para>The <variable>PARKINGDYNPOS</variable> variable specifies the + parking positions to use for the newly created dynamic parking lot. If + not set then the <literal>parkpos</literal> from the parking lot template + is used. + </para> + <note> + <para>This application must be used as the first extension priority + to be recognized as a parking access extension for blind transfers. + Blind transfers and the DTMF one-touch parking feature need this + distinction to operate properly. The parking access extension in + this case is treated like a dialplan hint. + </para> + </note> </description> <see-also> <ref type="application">ParkedCall</ref> @@ -462,7 +503,7 @@ struct ast_bridge *park_common_setup(struct ast_channel *parkee, struct ast_chan lot = parking_lot_find_by_name(lot_name); if (!lot) { - lot = parking_create_dynamic_lot(lot_name, parkee); + lot = parking_create_dynamic_lot(lot_name, parker); } if (!lot) { ast_log(LOG_ERROR, "Could not find parking lot: '%s'\n", lot_name); @@ -570,7 +611,7 @@ static int parked_call_app_exec(struct ast_channel *chan, const char *data) int target_space = -1; struct ast_bridge_features chan_features; char *parse; - char *lot_name; + const char *lot_name; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(lot_name); diff --git a/res/parking/parking_bridge_features.c b/res/parking/parking_bridge_features.c index ab0ea6f44..b4884dbfb 100644 --- a/res/parking/parking_bridge_features.c +++ b/res/parking/parking_bridge_features.c @@ -236,6 +236,7 @@ static struct ast_channel *park_local_transfer(struct ast_channel *parker, const /* Before we actually dial out let's inherit appropriate information. */ ast_channel_lock_both(parker, parkee); ast_channel_req_accountcodes(parkee, parker, AST_CHANNEL_REQUESTOR_REPLACEMENT); + ast_channel_parkinglot_set(parkee, ast_channel_parkinglot(parker)); ast_connected_line_copy_from_caller(ast_channel_connected(parkee), ast_channel_caller(parker)); ast_channel_inherit_variables(parker, parkee); ast_bridge_set_transfer_variables(parkee, ast_channel_name(parker), 0); @@ -473,21 +474,17 @@ static int parking_park_bridge_channel(struct ast_bridge_channel *bridge_channel static int parking_park_call(struct ast_bridge_channel *parker, char *exten, size_t length) { RAII_VAR(struct parking_lot *, lot, NULL, ao2_cleanup); - const char *lot_name = NULL; + const char *lot_name; ast_channel_lock(parker->chan); - lot_name = find_channel_parking_lot_name(parker->chan); - if (!ast_strlen_zero(lot_name)) { - lot_name = ast_strdupa(lot_name); - } + lot_name = ast_strdupa(find_channel_parking_lot_name(parker->chan)); ast_channel_unlock(parker->chan); - if (ast_strlen_zero(lot_name)) { - return -1; - } - lot = parking_lot_find_by_name(lot_name); if (!lot) { + lot = parking_create_dynamic_lot(lot_name, parker->chan); + } + if (!lot) { ast_log(AST_LOG_WARNING, "Cannot Park %s: lot %s unknown\n", ast_channel_name(parker->chan), lot_name); return -1; @@ -503,7 +500,8 @@ static int feature_park_call(struct ast_bridge_channel *bridge_channel, void *ho { SCOPED_MODULE_USE(parking_get_module_info()->self); - return parking_park_call(bridge_channel, NULL, 0); + parking_park_call(bridge_channel, NULL, 0); + return 0; } /*! diff --git a/res/parking/res_parking.h b/res/parking/res_parking.h index 3d77e514c..b8be0419b 100644 --- a/res/parking/res_parking.h +++ b/res/parking/res_parking.h @@ -308,8 +308,9 @@ struct parking_lot *parking_create_dynamic_lot_forced(const char *name, struct a * * \param chan The channel we want the parking lot name for * - * \retval name of the channel's assigned parking lot if it is defined by the channel in some way - * \retval name of the default parking lot if it is not + * \return name of the parking lot to use for the channel. + * + * \note Always returns a parking lot name. * * \note Channel needs to be locked while the returned string is in use. */ diff --git a/res/res_parking.c b/res/res_parking.c index 6696980c7..fbe256c93 100644 --- a/res/res_parking.c +++ b/res/res_parking.c @@ -35,6 +35,38 @@ <synopsis>Options that apply to every parking lot</synopsis> <configOption name="parkeddynamic"> <synopsis>Enables dynamically created parkinglots.</synopsis> + <description> + <para>If the option is enabled then the following variables can + be used to dynamically create new parking lots. + </para> + <para>The <variable>PARKINGDYNAMIC</variable> variable specifies the + parking lot to use as a template to create a dynamic parking lot. It + is an error to specify a non-existent parking lot for the template. + If not set then the default parking lot is used as the template. + </para> + <para>The <variable>PARKINGDYNCONTEXT</variable> variable specifies the + dialplan context to use for the newly created dynamic parking lot. If + not set then the context from the parking lot template is used. The + context is created if it does not already exist and the new parking lot + needs to create extensions. + </para> + <para>The <variable>PARKINGDYNEXTEN</variable> variable specifies the + <literal>parkext</literal> to use for the newly created dynamic + parking lot. If not set then the <literal>parkext</literal> is used from + the parking lot template. If the template does not specify a + <literal>parkext</literal> then no extensions are created for the newly + created parking lot. The dynamic parking lot cannot be created if it + needs to create extensions that overlap existing parking lot extensions. + The only exception to this is for the <literal>parkext</literal> + extension and only if neither of the overlaping parking lot's + <literal>parkext</literal> is exclusive. + </para> + <para>The <variable>PARKINGDYNPOS</variable> variable specifies the + parking positions to use for the newly created dynamic parking lot. If + not set then the <literal>parkpos</literal> from the parking lot template + is used. + </para> + </description> </configOption> </configObject> <configObject name="parking_lot"> @@ -45,19 +77,35 @@ </configOption> <configOption name="parkext"> <synopsis>Extension to park calls to this parking lot.</synopsis> - <description><para>If this option is used, this extension will automatically be created to place calls into - parking lots. In addition, if parkext_exclusive is set for this parking lot, the name of the parking lot - will be included in the application's arguments so that it only parks to this parking lot. The extension - will be created in <literal>context</literal>. Using this option also creates extensions for retrieving - parked calls from the parking spaces in the same context.</para></description> + <description> + <para>If this option is used, this extension will automatically + be created to place calls into parking lots. In addition, if + <literal>parkext_exclusive</literal> is set for this parking + lot, the name of the parking lot will be included in the + application's arguments so that it only parks to this parking + lot. The extension will be created in <literal>context</literal>. + Using this option also creates extensions for retrieving + parked calls from the parking spaces in the same context. + </para> + <note> + <para>Generated parking extensions cannot overlap. + The only exception is if neither overlapping + <literal>parkext</literal> is exclusive. + </para> + </note> + </description> </configOption> <configOption name="parkext_exclusive" default="no"> <synopsis>If yes, the extension registered as parkext will park exclusively to this parking lot.</synopsis> </configOption> <configOption name="parkpos" default="701-750"> <synopsis>Numerical range of parking spaces which can be used to retrieve parked calls.</synopsis> - <description><para>If parkext is set, these extensions will automatically be mapped in <literal>context</literal> - in order to pick up calls parked to these parking spaces.</para></description> + <description> + <para>If <literal>parkext</literal> is set, these extensions + will automatically be mapped in <literal>context</literal> + in order to pick up calls parked to these parking spaces. + </para> + </description> </configOption> <configOption name="parkinghints" default="no"> <synopsis>If yes, this parking lot will add hints automatically for parking spaces.</synopsis> @@ -178,9 +226,6 @@ </enumlist> </description> </configOption> - <configOption name="courtesytone"> - <synopsis>If set, the sound set will be played to whomever is set by parkedplay</synopsis> - </configOption> </configObject> </configFile> </configInfo> @@ -568,14 +613,13 @@ const char *find_channel_parking_lot_name(struct ast_channel *chan) /* The channel variable overrides everything */ name = pbx_builtin_getvar_helper(chan, "PARKINGLOT"); - if (ast_strlen_zero(name) && !ast_strlen_zero(ast_channel_parkinglot(chan))) { - /* Use the channel's parking lot. */ - name = ast_channel_parkinglot(chan); - } - - /* If the name couldn't be pulled from that either, use the default parking lot name. */ if (ast_strlen_zero(name)) { - name = DEFAULT_PARKING_LOT; + /* Try the channel's parking lot. */ + name = ast_channel_parkinglot(chan); + if (ast_strlen_zero(name)) { + /* Fall back to the default parking lot. */ + name = DEFAULT_PARKING_LOT; + } } return name; |