[asterisk-commits] jrose: branch jrose/bridge_projects r384591 - in /team/jrose/bridge_projects:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 2 15:23:18 CDT 2013


Author: jrose
Date: Tue Apr  2 15:23:15 2013
New Revision: 384591

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384591
Log:
updates for dlee's review on 4/1/2013

Modified:
    team/jrose/bridge_projects/CHANGES
    team/jrose/bridge_projects/include/asterisk/parking.h
    team/jrose/bridge_projects/main/features.c
    team/jrose/bridge_projects/main/parking.c
    team/jrose/bridge_projects/res/parking/parking_manager.c

Modified: team/jrose/bridge_projects/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/CHANGES?view=diff&rev=384591&r1=384590&r2=384591
==============================================================================
--- team/jrose/bridge_projects/CHANGES (original)
+++ team/jrose/bridge_projects/CHANGES Tue Apr  2 15:23:15 2013
@@ -54,7 +54,7 @@
    'UnParkedCall' have changed significantly in the new res_parking module.
    First, channel snapshot data is included for both the parker and the parkee
    in lieu of the "From" and "Channel" fields. They follow standard channel
-   snapshot format but each field is suffixed with '(parker)' or '(parkee')
+   snapshot format but each field is suffixed with '(parker)' or '(parkee)'
    depending on which side it applies to. The 'Exten' field is replaced with
    'ParkingSpace' since the registration of extensions as for parking spaces
    is no longer mandatory.
@@ -131,12 +131,6 @@
 
  * Extensions are no longer automatically created in the dialplan to park calls,
    pickup parked calls, etc by default.
-
-   * NOTE *
-   An option should be implemented before release that will enable automatic
-   extension creation. The extensions will be different and there will be no
-   updating the dial plan as calls are parked and unparked, but the functionality
-   should remain essentially the same.
 
  * adsipark is no longer supported under the new parking model
 

Modified: team/jrose/bridge_projects/include/asterisk/parking.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/parking.h?view=diff&rev=384591&r1=384590&r2=384591
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/parking.h (original)
+++ team/jrose/bridge_projects/include/asterisk/parking.h Tue Apr  2 15:23:15 2013
@@ -44,11 +44,11 @@
 	struct ast_channel_snapshot *parkee;
 	struct ast_channel_snapshot *parker;
 	enum ast_parked_call_event_type event_type;
+	long unsigned int timeout;
+	long unsigned int duration;
+	unsigned int parkingspace;
 	AST_DECLARE_STRING_FIELDS(
 		AST_STRING_FIELD(parkinglot);
-		AST_STRING_FIELD(parkingspace);
-		AST_STRING_FIELD(timeout);
-		AST_STRING_FIELD(duration);
 	);
 };
 
@@ -67,7 +67,7 @@
  * \retval NULL if the parked call payload can't be allocated
  * \retval reference to a newly created parked call payload
  */
-struct ast_parked_call_payload *ast_parked_call_payload_create(enum ast_parked_call_event_type event_type, struct ast_channel_snapshot *parkee_snapshot, struct ast_channel_snapshot *parker_snapshot, const char *parkinglot, int parkingspace, long int timeout, long int duration);
+struct ast_parked_call_payload *ast_parked_call_payload_create(enum ast_parked_call_event_type event_type, struct ast_channel_snapshot *parkee_snapshot, struct ast_channel_snapshot *parker_snapshot, const char *parkinglot, unsigned int parkingspace, unsigned long int timeout, unsigned long int duration);
 
 /*!
  * \brief initialize parking stasis types

Modified: team/jrose/bridge_projects/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/main/features.c?view=diff&rev=384591&r1=384590&r2=384591
==============================================================================
--- team/jrose/bridge_projects/main/features.c (original)
+++ team/jrose/bridge_projects/main/features.c Tue Apr  2 15:23:15 2013
@@ -6283,8 +6283,6 @@
 {
 	int i;
 	struct ast_call_feature *feature;
-	struct ao2_iterator iter;
-	struct ast_parkinglot *curlot;
 #define HFS_FORMAT "%-25s %-7s %-7s\n"
 
 	switch (cmd) {
@@ -6340,28 +6338,7 @@
 		AST_RWLIST_UNLOCK(&feature_groups);
 	}
 
-	iter = ao2_iterator_init(parkinglots, 0);
-	while ((curlot = ao2_iterator_next(&iter))) {
-		ast_cli(a->fd, "\nCall parking (Parking lot: %s)\n", curlot->name);
-		ast_cli(a->fd, "------------\n");
-		ast_cli(a->fd,"%-22s:      %s\n", "Parking extension", curlot->cfg.parkext);
-		ast_cli(a->fd,"%-22s:      %s\n", "Parking context", curlot->cfg.parking_con);
-		ast_cli(a->fd,"%-22s:      %d-%d\n", "Parked call extensions",
-			curlot->cfg.parking_start, curlot->cfg.parking_stop);
-		ast_cli(a->fd,"%-22s:      %u ms\n", "Parkingtime", curlot->cfg.parkingtime);
-		ast_cli(a->fd,"%-22s:      %s\n", "Comeback to origin",
-				(curlot->cfg.comebacktoorigin ? "yes" : "no"));
-		ast_cli(a->fd,"%-22s:      %s%s\n", "Comeback context",
-				curlot->cfg.comebackcontext, (curlot->cfg.comebacktoorigin ?
-					" (comebacktoorigin=yes, not used)" : ""));
-		ast_cli(a->fd,"%-22s:      %d\n", "Comeback dial time",
-				curlot->cfg.comebackdialtime);
-		ast_cli(a->fd,"%-22s:      %s\n", "MusicOnHold class", curlot->cfg.mohclass);
-		ast_cli(a->fd,"%-22s:      %s\n", "Enabled", AST_CLI_YESNO(!curlot->disabled));
-		ast_cli(a->fd,"\n");
-		ao2_ref(curlot, -1);
-	}
-	ao2_iterator_destroy(&iter);
+	ast_cli(a->fd, "\n");
 
 	return CLI_SUCCESS;
 }
@@ -6601,77 +6578,9 @@
 	return 0;
 }
 
-/*!
- * \brief CLI command to list parked calls
- * \param e
- * \param cmd
- * \param a
- *
- * Check right usage, lock parking lot, display parked calls, unlock parking lot list.
- * \retval CLI_SUCCESS on success.
- * \retval CLI_SHOWUSAGE on incorrect number of arguments.
- * \retval NULL when tab completion is used.
- */
-static char *handle_parkedcalls(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	struct parkeduser *cur;
-	int numparked = 0;
-	struct ao2_iterator iter;
-	struct ast_parkinglot *curlot;
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "parkedcalls show";
-		e->usage =
-			"Usage: parkedcalls show\n"
-			"       List currently parked calls\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc > e->args)
-		return CLI_SHOWUSAGE;
-
-	ast_cli(a->fd, "%-10s %-25s (%-15s %-12s %4s) %s\n", "Num", "Channel",
-		"Context", "Extension", "Pri", "Timeout");
-
-	iter = ao2_iterator_init(parkinglots, 0);
-	while ((curlot = ao2_iterator_next(&iter))) {
-		int lotparked = 0;
-
-		/* subtract ref for iterator and for configured parking lot */
-		ast_cli(a->fd, "*** Parking lot: %s (%d)\n", curlot->name,
-			ao2_ref(curlot, 0) - 2 - (curlot == default_parkinglot));
-
-		AST_LIST_LOCK(&curlot->parkings);
-		AST_LIST_TRAVERSE(&curlot->parkings, cur, list) {
-			ast_cli(a->fd, "%-10.10s %-25s (%-15s %-12s %4d) %6lds\n",
-				cur->parkingexten, ast_channel_name(cur->chan), cur->context, cur->exten,
-				cur->priority,
-				(long) (cur->start.tv_sec + (cur->parkingtime / 1000) - time(NULL)));
-			++lotparked;
-		}
-		AST_LIST_UNLOCK(&curlot->parkings);
-		if (lotparked) {
-			numparked += lotparked;
-			ast_cli(a->fd, "   %d parked call%s in parking lot %s\n", lotparked,
-				ESS(lotparked), curlot->name);
-		}
-
-		ao2_ref(curlot, -1);
-	}
-	ao2_iterator_destroy(&iter);
-
-	ast_cli(a->fd, "---\n%d parked call%s in total.\n", numparked, ESS(numparked));
-
-	return CLI_SUCCESS;
-}
-
 static struct ast_cli_entry cli_features[] = {
 	AST_CLI_DEFINE(handle_feature_show, "Lists configured features"),
 	AST_CLI_DEFINE(handle_features_reload, "Reloads configured features"),
-	AST_CLI_DEFINE(handle_parkedcalls, "List currently parked calls"),
 };
 
 /*!

Modified: team/jrose/bridge_projects/main/parking.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/main/parking.c?view=diff&rev=384591&r1=384590&r2=384591
==============================================================================
--- team/jrose/bridge_projects/main/parking.c (original)
+++ team/jrose/bridge_projects/main/parking.c Tue Apr  2 15:23:15 2013
@@ -71,7 +71,7 @@
 	ast_string_field_free_memory(park_obj);
 }
 
-struct ast_parked_call_payload *ast_parked_call_payload_create(enum ast_parked_call_event_type event_type, struct ast_channel_snapshot *parkee_snapshot, struct ast_channel_snapshot *parker_snapshot, const char *parkinglot, int parkingspace, long int timeout, long int duration)
+struct ast_parked_call_payload *ast_parked_call_payload_create(enum ast_parked_call_event_type event_type, struct ast_channel_snapshot *parkee_snapshot, struct ast_channel_snapshot *parker_snapshot, const char *parkinglot, unsigned int parkingspace, unsigned long int timeout, unsigned long int duration)
 {
 	RAII_VAR(struct ast_parked_call_payload *, payload, NULL, ao2_cleanup);
 
@@ -93,9 +93,9 @@
 	payload->parker = parker_snapshot;
 
 	ast_string_field_set(payload, parkinglot, parkinglot);
-	ast_string_field_build(payload, parkingspace, "%d", parkingspace);
-	ast_string_field_build(payload, timeout, "%ld", timeout);
-	ast_string_field_build(payload, duration, "%ld", duration);
+	payload->parkingspace = parkingspace;
+	payload->timeout = timeout;
+	payload->duration = duration;
 
 	/* Bump the ref count by one since RAII_VAR is going to eat one when we leave. */
 	ao2_ref(payload, +1);

Modified: team/jrose/bridge_projects/res/parking/parking_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_manager.c?view=diff&rev=384591&r1=384590&r2=384591
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_manager.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_manager.c Tue Apr  2 15:23:15 2013
@@ -111,9 +111,9 @@
 		"%s" /* parkee channel state */
 		"%s" /* parker channel state */
 		"Parkinglot: %s\r\n"
-		"ParkingSpace: %s\r\n"
-		"ParkingTimeout: %s\r\n"
-		"ParkingDuration: %s\r\n",
+		"ParkingSpace: %u\r\n"
+		"ParkingTimeout: %lu\r\n"
+		"ParkingDuration: %lu\r\n",
 
 		ast_str_buffer(parkee_string),
 		ast_str_buffer(parker_string),
@@ -311,26 +311,28 @@
 	}
 }
 
+static void parking_manager_enable_stasis(void)
+{
+	ast_parking_stasis_init();
+	if (!parking_sub) {
+		parking_sub = stasis_subscribe(ast_parking_topic(), parking_event_cb, NULL);
+	}
+}
+
+int load_parking_manager(void)
+{
+	int res;
+
+	res = ast_manager_register_xml_core("Parkinglots", 0, manager_parking_lot_list);
+	res |= ast_manager_register_xml_core("ParkedCalls", 0, manager_parking_status);
+	parking_manager_enable_stasis();
+	return res ? -1 : 0;
+}
+
 static void parking_manager_disable_stasis(void)
 {
 	parking_sub = stasis_unsubscribe(parking_sub);
 	ast_parking_stasis_disable();
-}
-
-int load_parking_manager(void)
-{
-	int res;
-
-	res = ast_manager_register_xml_core("Parkinglots", 0, manager_parking_lot_list);
-	res |= ast_manager_register_xml_core("ParkedCalls", 0, manager_parking_status);
-
-	ast_parking_stasis_init();
-
-	if (!parking_sub) {
-		parking_sub = stasis_subscribe(ast_parking_topic(), parking_event_cb, NULL);
-	}
-
-	return res ? -1 : 0;
 }
 
 void unload_parking_manager(void)




More information about the asterisk-commits mailing list