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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 11 09:40:01 CDT 2013


Author: jrose
Date: Thu Apr 11 09:39:58 2013
New Revision: 385306

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385306
Log:
Fix a crash that can occur when picking up a call that isn't fully parked.

Modified:
    team/jrose/bridge_projects/res/parking/parking_bridge.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_bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_bridge.c?view=diff&rev=385306&r1=385305&r2=385306
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_bridge.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_bridge.c Thu Apr 11 09:39:58 2013
@@ -120,8 +120,7 @@
 	ao2_iterator_destroy(&iter);
 
 	if (!pu) {
-		/* This should be impossible since the parked user for the channel should be generated before it enters if it's not swapping. */
-		return -1;
+		ast_assert(0);
 	}
 
 	/* Apply parking duration limits */
@@ -130,6 +129,9 @@
 
 	/* 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 */
+	pu->bridged = 1;
 
 	/* Generate ParkedCall Stasis Message */
 	publish_parked_call(pu, PARKED_CALL);

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=385306&r1=385305&r2=385306
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_controller.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_controller.c Thu Apr 11 09:39:58 2013
@@ -144,14 +144,20 @@
 
 static int retrieve_parked_user_first(void *obj, void *arg, int flags)
 {
-	return CMP_MATCH;
+	struct parked_user *user = obj;
+
+	if (user->bridged) {
+		return CMP_MATCH;
+	}
+
+	return 0;
 }
 
 static int retrieve_parked_user_targeted(void *obj, void *arg, int flags)
 {
 	int *target = arg;
 	struct parked_user *user = obj;
-	if (user->parking_space == *target) {
+	if (user->bridged && user->parking_space == *target) {
 		return CMP_MATCH;
 	}
 
@@ -225,10 +231,11 @@
 {
 	struct parked_user *pu = obj;
 
-	/* Free the reference to the bridge that this lot should have taken on creation */
 	ao2_cleanup(pu->lot_state);
+	pu->lot_state = NULL;
 
 	ao2_cleanup(pu->parker);
+	pu->parker = NULL;
 }
 
 /*! \internal

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=385306&r1=385305&r2=385306
==============================================================================
--- team/jrose/bridge_projects/res/parking/res_parking.h (original)
+++ team/jrose/bridge_projects/res/parking/res_parking.h Thu Apr 11 09:39:58 2013
@@ -123,6 +123,7 @@
 	unsigned int time_limit;                /*!< How long this specific channel may remain in the parking lot before timing out */
 	struct parking_lot_state *lot_state;    /*!< 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. */
 };
 
 /*!




More information about the asterisk-commits mailing list