aboutsummaryrefslogtreecommitdiffstats
path: root/main/features.c
diff options
context:
space:
mode:
authorjrose <jrose@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-09 13:56:32 +0000
committerjrose <jrose@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-09 13:56:32 +0000
commitbc68932e2376ba798552887ea628bf048779d027 (patch)
tree647d4504bebd2f7ee439e793810df3df3a380ef3 /main/features.c
parenta71f0300900ab2ab0d166eddf29cd0b9f4ccde2a (diff)
Allows ParkedCall application to specify a parkinglot.
When invoking the app parkedcall, the argument can now include '@parkinglot' after the extension. (closes issue #18777) Reported by: cartama Patches: 0018777.diff uploaded by cartama (license 1157) Review: https://reviewboard.asterisk.org/r/1209/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@318141 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/features.c')
-rw-r--r--main/features.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/main/features.c b/main/features.c
index c12a02c1c..4850f1c87 100644
--- a/main/features.c
+++ b/main/features.c
@@ -209,14 +209,22 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
Answer a parked call.
</synopsis>
<syntax>
- <parameter name="exten" required="true" />
+ <parameter name="exten" required="true" argsep="@">
+ <argument name="exten" required="true">
+ <para>Specify extension.</para>
+ </argument>
+ <argument name="parkinglot">
+ <para>Optionally specify a parkinglot.<literal>exten</literal>.</para>
+ </argument>
+ </parameter>
</syntax>
<description>
<para>Used to connect to a parked call. This application is always
registered internally and does not need to be explicitly added
into the dialplan, although you should include the <literal>parkedcalls</literal>
context. If no extension is provided, then the first available
- parked call will be acquired.</para>
+ parked call will be acquired. If <literal>parkinglot</literal> is included,the
+ parkinglot with that name will be used to seek the extension.</para>
</description>
<see-also>
<ref type="application">Park</ref>
@@ -646,6 +654,18 @@ static int find_parkinglot_by_exten_cb(void *obj, void *args, int flags)
return 0;
}
+static int find_parkinglot_by_name_cb(void *obj, void *args, int flags)
+{
+ struct ast_parkinglot *parkinglot = obj;
+ const char *parkname = args;
+
+ if (!strcmp(parkinglot->name, parkname)) {
+ return CMP_MATCH | CMP_STOP;
+ }
+
+ return 0;
+}
+
int ast_parking_ext_valid(const char *exten_str, struct ast_channel *chan, const char *context)
{
struct ast_exten *exten;
@@ -4478,12 +4498,25 @@ static int park_exec_full(struct ast_channel *chan, const char *data)
int park = 0;
struct ast_bridge_config config;
struct ast_parkinglot *parkinglot;
+ const char *lotname_split = NULL; /* name of the parking lot if an '@' symbol is included in data */
if (data) {
- park = atoi((char *) data);
+ sscanf(data, "%d", &park);
+ if ((lotname_split = strchr(data, (int)'@'))) {
+ lotname_split++;
+ }
+ }
+
+ /*
+ * If we found an '@' in data, we want to specify the parkinglot used by its name.
+ * otherwise we just search by position.
+ */
+ if (lotname_split) {
+ parkinglot = ao2_callback(parkinglots, 0, find_parkinglot_by_name_cb, (void *) (lotname_split));
+ } else {
+ parkinglot = ao2_callback(parkinglots, 0, find_parkinglot_by_position_cb, (void *) &park);
}
- parkinglot = ao2_callback(parkinglots, 0, find_parkinglot_by_position_cb, (void *) &park);
if (!parkinglot)
parkinglot = default_parkinglot;