summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-05-14 21:17:52 +0000
committerRussell Bryant <russell@russellbryant.com>2007-05-14 21:17:52 +0000
commit17ab54e52a3996f3ecd8db30a4fdc12ef343ea29 (patch)
tree68721170ce6af89da71a4f60241c56dfae8fbd21 /res
parentfa2622cb1d27291c39290ca7a76bd31e817d5d56 (diff)
Merged revisions 64353 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r64353 | russell | 2007-05-14 16:16:39 -0500 (Mon, 14 May 2007) | 4 lines When someone requests a specific parking space using the PARKINGEXTEN variable, ensure that no other caller is already there. (issue #9723, reported by mdu113, patch by me) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@64354 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_features.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/res/res_features.c b/res/res_features.c
index a8b9bb8f7..d41010e8c 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -336,6 +336,23 @@ static enum ast_device_state 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 */
@@ -361,6 +378,12 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
}
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;