[asterisk-commits] jrose: trunk r318141 - in /trunk: CHANGES main/features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 9 08:56:39 CDT 2011


Author: jrose
Date: Mon May  9 08:56:32 2011
New Revision: 318141

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=318141
Log:
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/


Modified:
    trunk/CHANGES
    trunk/main/features.c

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=318141&r1=318140&r2=318141
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon May  9 08:56:32 2011
@@ -15,6 +15,7 @@
 Parking
 -------
  * parkedmusicclass can now be set for non-default parking lots.
+ * ParkedCall application can now specify a specific parkinglot.
 
 Asterisk Manager Interface
 --------------------------
@@ -304,6 +305,8 @@
  * Added 'D' command to ExternalIVR full details in doc/externalivr.txt
  * Added 'v' option to MeetMe to play voicemail greetings when a user joins/leaves
    a MeetMe conference
+ * Added ability to include '@parkinglot' to ParkedCall extension in order to specify
+   a specific parkinglot on which to search the extension.
 
 Dialplan Functions
 ------------------

Modified: trunk/main/features.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features.c?view=diff&rev=318141&r1=318140&r2=318141
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Mon May  9 08:56:32 2011
@@ -209,14 +209,22 @@
 			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 @@
 	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 @@
 	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);
-	}
-
-	parkinglot = ao2_callback(parkinglots, 0, find_parkinglot_by_position_cb, (void *) &park);
+		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);
+	}
+
 	if (!parkinglot)
 		parkinglot = default_parkinglot;
 




More information about the asterisk-commits mailing list