summaryrefslogtreecommitdiff
path: root/res/res_parking.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-03-18 14:01:02 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-03-25 18:27:20 -0500
commita4189763ab562ee2e8e79fda60b213ee90aab6f1 (patch)
treeefb672e9f605011f11ad227e7fa6f7b2eff3121c /res/res_parking.c
parent01150597f60cb0e4b906b2bf2b94188bb3b6ca14 (diff)
res_parking: Misc fixes.
res/parking/parking_applications.c: * Add malloc fail checks in setup_park_common_datastore(). * Fix playing parking failed announcement to only happen on non-blind transfers in park_app_exec(). It could never go out before because a test was provedly always false. res/parking/parking_bridge.c: * Fix NULL tolerance in generate_parked_user() because bridge_parking_push() can theoretically pass a NULL parker channel if the parker channel went away for some reason. * Clarify some weird code dealing with blind_transfer in bridge_parking_push(). res/parking/parking_bridge_features.c: * Made park_local_transfer() set BLINDTRANSFER on the Local;1 channel which will be bulk copied to the Local;2 channel on the subsequent ast_call(). The additional advantage is if the parker channel has the BLINDTRANSFER and ATTENDEDTRANSFER variables set they are now guaranteed to be overridden. res/parking/parking_manager.c: * Fix AMI Park action input range checking of the Timeout header in manager_park(). * Reduced locking scope to where needed in manager_park(). res/res_parking.c: * Fix some off nominal missing unlocks by eliminating the returns. Change-Id: Ib64945bc285acb05a306dc12e6f16854898915ca
Diffstat (limited to 'res/res_parking.c')
-rw-r--r--res/res_parking.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/res/res_parking.c b/res/res_parking.c
index 3edbd4663..6696980c7 100644
--- a/res/res_parking.c
+++ b/res/res_parking.c
@@ -738,31 +738,21 @@ int parking_lot_cfg_create_extensions(struct parking_lot_cfg *lot_cfg)
}
/* We need the contexts list locked to safely be able to both read and lock the specific context within */
- if (ast_wrlock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock the contexts list.\n");
- return -1;
- }
+ ast_wrlock_contexts();
if (!(lot_context = ast_context_find_or_create(NULL, NULL, lot_cfg->parking_con, parkext_registrar_pointer))) {
ast_log(LOG_ERROR, "Parking lot '%s' -- Needs a context '%s' which does not exist and Asterisk was unable to create\n",
lot_cfg->name, lot_cfg->parking_con);
- if (ast_unlock_contexts()) {
- ast_assert(0);
- }
+ ast_unlock_contexts();
return -1;
}
/* Once we know what context we will be modifying, we need to write lock it because we will be reading extensions
* and we don't want something else to destroy them while we are looking at them.
*/
- if (ast_wrlock_context(lot_context)) {
- ast_log(LOG_ERROR, "failed to obtain write lock on context\n");
- return -1;
- }
+ ast_wrlock_context(lot_context);
- if (ast_unlock_contexts()) {
- ast_assert(0);
- }
+ ast_unlock_contexts();
/* Handle generation/confirmation for the Park extension */
if ((existing_exten = pbx_find_extension(NULL, NULL, &find_info, lot_cfg->parking_con, lot_cfg->parkext, 1, NULL, NULL, E_MATCH))) {
@@ -830,9 +820,7 @@ int parking_lot_cfg_create_extensions(struct parking_lot_cfg *lot_cfg)
}
}
- if (ast_unlock_context(lot_context)) {
- ast_assert(0);
- }
+ ast_unlock_context(lot_context);
return 0;
}