[asterisk-commits] jrose: branch jrose/bridge_projects r386687 - /team/jrose/bridge_projects/res...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 26 17:11:57 CDT 2013


Author: jrose
Date: Fri Apr 26 17:11:53 2013
New Revision: 386687

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386687
Log:
shorten bridge push time by moving saynum into a playfile action frame.

Modified:
    team/jrose/bridge_projects/res/parking/parking_applications.c
    team/jrose/bridge_projects/res/parking/parking_bridge.c
    team/jrose/bridge_projects/res/parking/parking_bridge_features.c
    team/jrose/bridge_projects/res/parking/parking_controller.c
    team/jrose/bridge_projects/res/parking/res_parking.h

Modified: team/jrose/bridge_projects/res/parking/parking_applications.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_applications.c?view=diff&rev=386687&r1=386686&r2=386687
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_applications.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_applications.c Fri Apr 26 17:11:53 2013
@@ -398,10 +398,7 @@
 	}
 
 	/* Now for the fun part... park it! */
-	if (ast_bridge_join(parking_bridge, chan, NULL, &chan_features, NULL, 0)) {
-		/* XXX Need to add reactions based on the return value. */
-		//ast_stream_and_wait(chan, "pbx-parkingfailed", "");
-	}
+	ast_bridge_join(parking_bridge, chan, NULL, &chan_features, NULL, 0);
 
 	/*
 	 * If the bridge was broken for a hangup that isn't real, then

Modified: team/jrose/bridge_projects/res/parking/parking_bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_bridge.c?view=diff&rev=386687&r1=386686&r2=386687
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_bridge.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_bridge.c Fri Apr 26 17:11:53 2013
@@ -235,23 +235,21 @@
 		return -1;
 	}
 
+	/* Generate ParkedCall Stasis Message */
+	publish_parked_call(pu, PARKED_CALL);
+
+	/* If the parkee and the parker are the same and silence_announce isn't set, play the announcement to the parkee */
+	if (!strcmp(blind_transfer, ast_channel_name(bridge_channel->chan)) && !silence) {
+		char saynum_buf[16];
+		snprintf(saynum_buf, sizeof(saynum_buf), "%u %u", 0, pu->parking_space);
+		ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);
+	}
+
 	/* Apply parking duration limits */
 	parking_set_duration(bridge_channel->features, pu);
 
 	/* Set this to the bridge pvt so that we don't have to refind the parked user associated with this bridge channel again. */
 	bridge_channel->bridge_pvt = pu;
-
-	/* Raise bridged flag so that the call can actually be retrieved. XXX this whole concept probably isn't necessary any more. */
-	pu->bridged = 1;
-
-	/* If the parkee and the parker are the same and silence_announce isn't set, play the announcement to the parkee */
-	if (!strcmp(blind_transfer, ast_channel_name(bridge_channel->chan)) && !silence) {
-		ast_say_digits(bridge_channel->chan, pu->parking_space, "", ast_channel_language(bridge_channel->chan));
-	}
-
-	reset_parked_time(pu);
-	/* Generate ParkedCall Stasis Message */
-	publish_parked_call(pu, PARKED_CALL);
 
 	return 0;
 }

Modified: team/jrose/bridge_projects/res/parking/parking_bridge_features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_bridge_features.c?view=diff&rev=386687&r1=386686&r2=386687
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_bridge_features.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_bridge_features.c Fri Apr 26 17:11:53 2013
@@ -61,22 +61,6 @@
 	.destroy = parked_subscription_datastore_destroy,
 };
 
-static void say_parking_space(struct ast_bridge_channel *bridge_channel, const char *playfile)
-{
-	int numeric_value;
-
-	if (sscanf(playfile, "%d", &numeric_value) != 1) {
-		/* If say_parking_space is called with a non-numeric string, we have a problem. */
-		ast_assert(0);
-		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
-		return;
-	}
-
-	ast_say_digits(bridge_channel->chan, numeric_value, "", ast_channel_language(bridge_channel->chan));
-
-	ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
-}
-
 static void parker_parked_call_message_response(struct ast_parked_call_payload *message, struct parked_subscription_data *data,
 	struct stasis_subscription *sub)
 {
@@ -114,7 +98,7 @@
 
 	if (message->event_type == PARKED_CALL) {
 		/* queue the saynum on the bridge channel and hangup */
-		snprintf(saynum_buf, sizeof(saynum_buf), "%u", message->parkingspace);
+		snprintf(saynum_buf, sizeof(saynum_buf), "%u %u", 1, message->parkingspace);
 
 		ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);
 
@@ -343,8 +327,6 @@
 		return;
 	}
 
-	/* XXX Most of this can be moved into the push. Doing so will keep all of the publishing of parking events in
-	 * the bridge join/pull functions. Also, silence option is not respected here in park_common_setup */
 	if (!(parking_bridge = park_common_setup(bridge_channel->chan, parker, app_data))) {
 		publish_parked_call_failure(bridge_channel->chan);
 		return;
@@ -418,6 +400,25 @@
 	return -1;
 }
 
+void say_parking_space(struct ast_bridge_channel *bridge_channel, const char *payload)
+{
+	int numeric_value;
+	int hangup_after;
+
+	if (sscanf(payload, "%u %u", &hangup_after, &numeric_value) != 2) {
+		/* If say_parking_space is called with a non-numeric string, we have a problem. */
+		ast_assert(0);
+		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+		return;
+	}
+
+	ast_say_digits(bridge_channel->chan, numeric_value, "", ast_channel_language(bridge_channel->chan));
+
+	if (hangup_after) {
+		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+	}
+}
+
 void parking_set_duration(struct ast_bridge_features *features, struct parked_user *user)
 {
 	unsigned int time_limit;

Modified: team/jrose/bridge_projects/res/parking/parking_controller.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_controller.c?view=diff&rev=386687&r1=386686&r2=386687
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_controller.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_controller.c Fri Apr 26 17:11:53 2013
@@ -144,20 +144,14 @@
 
 static int retrieve_parked_user_first(void *obj, void *arg, int flags)
 {
-	struct parked_user *user = obj;
-
-	if (user->bridged) {
-		return CMP_MATCH;
-	}
-
-	return 0;
+	return CMP_MATCH;
 }
 
 static int retrieve_parked_user_targeted(void *obj, void *arg, int flags)
 {
 	int *target = arg;
 	struct parked_user *user = obj;
-	if (user->bridged && user->parking_space == *target) {
+	if (user->parking_space == *target) {
 		return CMP_MATCH;
 	}
 

Modified: team/jrose/bridge_projects/res/parking/res_parking.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/res_parking.h?view=diff&rev=386687&r1=386686&r2=386687
==============================================================================
--- team/jrose/bridge_projects/res/parking/res_parking.h (original)
+++ team/jrose/bridge_projects/res/parking/res_parking.h Fri Apr 26 17:11:53 2013
@@ -106,7 +106,6 @@
 	unsigned int time_limit;                  /*!< How long this specific channel may remain in the parking lot before timing out */
 	struct parking_lot *lot;      /*!< Which parking lot the user is parked to */
 	enum park_call_resolution resolution;     /*!< How did the parking session end? If the call is in a bridge, lock parked_user before checking/setting */
-	int bridged;                              /*!< Flag raised when parked user enters the parking bridge. Used to determine a parked user is retrievable. */
 };
 
 /*!
@@ -211,6 +210,13 @@
  * \param force_ringing Use ringing instead of music on hold
  */
 void parking_channel_set_roles(struct ast_channel *chan, struct parking_lot *lot, int force_ringing);
+
+/*!
+ * \since 12
+ * \brief custom callback function for ast_bridge_channel_queue_playfile which plays a parking space
+ *        and optionally hangs up the call afterwards based on the payload in playfile.
+ */
+void say_parking_space(struct ast_bridge_channel *bridge_channel, const char *payload);
 
 /*!
  * \since 12




More information about the asterisk-commits mailing list