diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-15 19:52:18 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-15 19:52:18 +0000 |
commit | a76fface43c8aa1f7e0969b17370ab9b080c0de3 (patch) | |
tree | 89170c144eaf3f3485365fe81c87d2496e8ec374 /res/res_features.c | |
parent | bb420210ceefe17806e6a651728155efcc0c69d3 (diff) |
Properly fix a problem that occurs when you set PARKINGEXTEN to an exten where
a call is already parked. (issue #9723, patch by me)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@64426 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_features.c')
-rw-r--r-- | res/res_features.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/res/res_features.c b/res/res_features.c index bc045bb9d..879b2b591 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -305,23 +305,6 @@ static int metermaidstate(const char *data) return AST_DEVICE_INUSE; } -/*! - * \brief Check to see if a parking space is in use - * \return non-zero if in use, zero if not in use - * \note Assumes parking_lock is locked - */ -static int check_parking_space_inuse(int space) -{ - struct parkeduser *pu; - - for (pu = parkinglot; pu; pu = pu->next) { - if (pu->parkingnum == space) - return 1; - } - - return 0; -} - /*! \brief Park a call \note We put the user in the parking list, then wake up the parking thread to be sure it looks after these channels too */ @@ -342,17 +325,13 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou parkingexten = pbx_builtin_getvar_helper(chan, "PARKINGEXTEN"); if (!ast_strlen_zero(parkingexten)) { if (ast_exists_extension(NULL, parking_con, parkingexten, 1, NULL)) { + ast_mutex_unlock(&parking_lock); + free(pu); ast_log(LOG_WARNING, "Requested parking extension already exists: %s@%s\n", parkingexten, parking_con); return 0; /* Continue execution if possible */ } ast_copy_string(pu->parkingexten, parkingexten, sizeof(pu->parkingexten)); x = atoi(parkingexten); - if (check_parking_space_inuse(x)) { - ast_mutex_unlock(&parking_lock); - free(pu); - ast_log(LOG_WARNING, "Requested parking space %d via PARKINGEXTEN, but it is in use!\n", x); - return -1; - } } else { /* Select parking space within range */ parking_range = parking_stop - parking_start+1; |