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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 12 10:26:41 CDT 2013


Author: jrose
Date: Fri Apr 12 10:26:40 2013
New Revision: 385494

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385494
Log:
Document parking manager events and add retriever to UnParkedCall events

Modified:
    team/jrose/bridge_projects/include/asterisk/parking.h
    team/jrose/bridge_projects/main/parking.c
    team/jrose/bridge_projects/res/parking/parking_applications.c
    team/jrose/bridge_projects/res/parking/parking_manager.c
    team/jrose/bridge_projects/res/parking/res_parking.h

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=385494&r1=385493&r2=385494
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/parking.h (original)
+++ team/jrose/bridge_projects/include/asterisk/parking.h Fri Apr 12 10:26:40 2013
@@ -45,6 +45,7 @@
 struct ast_parked_call_payload {
 	struct ast_channel_snapshot *parkee;             /*!< Snapshot of the channel that is parked */
 	struct ast_channel_snapshot *parker;             /*!< Snapshot of the channel that parked the call */
+	struct ast_channel_snapshot *retriever;          /*!< Snapshot of the channel that retrieved the call */
 	enum ast_parked_call_event_type event_type;      /*!< Reason for issuing the parked call message */
 	long unsigned int timeout;                       /*!< Time remaining before the call times out (seconds ) */
 	long unsigned int duration;                      /*!< How long the parkee has been parked (seconds) */
@@ -61,6 +62,7 @@
  * \param event_type What kind of parked call event is happening
  * \param parkee_snapshot channel snapshot of the parkee
  * \param parker_snapshot channel snapshot of the parker
+ * \param retriever_snapshot channel snapshot of the retriever (NULL allowed)
  * \param parkinglot name of the parking lot where the parked call is parked
  * \param parkingspace what numerical parking space the parked call is parked in
  * \param timeout how long the parked call can remain at the point this snapshot is created before timing out
@@ -69,7 +71,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, unsigned int parkingspace, unsigned long int timeout, unsigned 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, struct ast_channel_snapshot *retriever_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/parking.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/main/parking.c?view=diff&rev=385494&r1=385493&r2=385494
==============================================================================
--- team/jrose/bridge_projects/main/parking.c (original)
+++ team/jrose/bridge_projects/main/parking.c Fri Apr 12 10:26:40 2013
@@ -80,7 +80,8 @@
 
 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,
+		struct ast_channel_snapshot *retriever_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);
@@ -101,6 +102,11 @@
 
 	ao2_ref(parker_snapshot, +1);
 	payload->parker = parker_snapshot;
+
+	if (retriever_snapshot) {
+		ao2_ref(retriever_snapshot, +1);
+		payload->retriever = retriever_snapshot;
+	}
 
 	ast_string_field_set(payload, parkinglot, parkinglot);
 	payload->parkingspace = parkingspace;

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=385494&r1=385493&r2=385494
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_applications.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_applications.c Fri Apr 12 10:26:40 2013
@@ -386,6 +386,9 @@
 		return -1;
 	}
 
+	/* The parked call needs to know who is retrieving it before we move it out of the parking bridge */
+	pu->retriever = ast_channel_snapshot_create(chan);
+
 	/* Create bridge */
 	retrieval_bridge = ast_bridge_base_new(
 		AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_MULTIMIX,

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=385494&r1=385493&r2=385494
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_manager.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_manager.c Fri Apr 12 10:26:40 2013
@@ -61,6 +61,163 @@
 			<para>List parked calls.</para>
 		</description>
 	</manager>
+	<managerEvent language="en_US" name="ParkedCall">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<synopsis>Raised when a channel is parked.</synopsis>
+			<syntax>
+				<parameter name="ChannelParkee">
+				</parameter>
+				<parameter name="ChannelStateParkee">
+					<para>A numeric code for the channel's current state, related to ChannelStateDesc</para>
+				</parameter>
+				<parameter name="ChannelStateDescParkee">
+					<enumlist>
+						<enum name="Down"/>
+						<enum name="Rsrvd"/>
+						<enum name="OffHook"/>
+						<enum name="Dialing"/>
+						<enum name="Ring"/>
+						<enum name="Ringing"/>
+						<enum name="Up"/>
+						<enum name="Busy"/>
+						<enum name="Dialing Offhook"/>
+						<enum name="Pre-ring"/>
+						<enum name="Unknown"/>
+					</enumlist>
+				</parameter>
+				<parameter name="CallerIDNumParkee">
+				</parameter>
+				<parameter name="CallerIDNameParkee">
+				</parameter>
+				<parameter name="ConnectedLineNumParkee">
+				</parameter>
+				<parameter name="ConnectedLineNameParkee">
+				</parameter>
+				<parameter name="AccountCodeParkee">
+				</parameter>
+				<parameter name="ContextParkee">
+				</parameter>
+				<parameter name="ExtenParkee">
+				</parameter>
+				<parameter name="PriorityParkee">
+				</parameter>
+				<parameter name="UniqueidParkee">
+				</parameter>
+				<parameter name="ChannelParker">
+				</parameter>
+				<parameter name="ChannelStateParker">
+				<para>A numeric code for the channel's current state, related to ChannelStateDesc</para>
+				</parameter>
+				<parameter name="ChannelStateDescParker">
+					<enumlist>
+						<enum name="Down"/>
+						<enum name="Rsrvd"/>
+						<enum name="OffHook"/>
+						<enum name="Dialing"/>
+						<enum name="Ring"/>
+						<enum name="Ringing"/>
+						<enum name="Up"/>
+						<enum name="Busy"/>
+						<enum name="Dialing Offhook"/>
+						<enum name="Pre-ring"/>
+						<enum name="Unknown"/>
+					</enumlist>
+				</parameter>
+				<parameter name="CallerIDNumParker">
+				</parameter>
+				<parameter name="CallerIDNameParker">
+				</parameter>
+				<parameter name="ConnectedLineNumParker">
+				</parameter>
+				<parameter name="ConnectedLineNameParker">
+				</parameter>
+				<parameter name="AccountCodeParker">
+				</parameter>
+				<parameter name="ContextParker">
+				</parameter>
+				<parameter name="ExtenParker">
+				</parameter>
+				<parameter name="PriorityParker">
+				</parameter>
+				<parameter name="UniqueidParker">
+				</parameter>
+				<parameter name="Parkinglot">
+					<para>Name of the parking lot that the parkee is parked in</para>
+				</parameter>
+				<parameter name="ParkingSpace">
+					<para>Parking Space that the parkee is parked in</para>
+				</parameter>
+				<parameter name="ParkingTimeout">
+				<para>Time remaining until the parkee is forcefully removed from parking in seconds</para>
+				</parameter>
+				<parameter name="ParkingDuration">
+					<para>Time the parkee has been in the parking bridge (in seconds)</para>
+				</parameter>
+			</syntax>
+		</managerEventInstance>
+	</managerEvent>
+	<managerEvent language="en_US" name="ParkedCallTimeOut">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<synopsis>Raised when a channel leaves a parking lot due to reaching the time limit of being parked.</synopsis>
+			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='ParkedCall']/managerEventInstance/syntax/parameter)" />
+			</syntax>
+		</managerEventInstance>
+	</managerEvent>
+	<managerEvent language="en_US" name="ParkedCallGiveUp">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<synopsis>Raised when a channel leaves a parking lot because it hung up without being answered.</synopsis>
+			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='ParkedCall']/managerEventInstance/syntax/parameter)" />
+			</syntax>
+		</managerEventInstance>
+	</managerEvent>
+	<managerEvent language="en_US" name="UnParkedCall">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<synopsis>Raised when a channel leaves a parking lot because it was retrieved from the parking lot and reconnected.</synopsis>
+			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='ParkedCall']/managerEventInstance/syntax/parameter)" />
+				<parameter name="ChannelRetriever">
+				</parameter>
+				<parameter name="ChannelStateRetriever">
+					<para>A numeric code for the channel's current state, related to ChannelStateDesc</para>
+				</parameter>
+				<parameter name="ChannelStateDescRetriever">
+					<enumlist>
+						<enum name="Down"/>
+						<enum name="Rsrvd"/>
+						<enum name="OffHook"/>
+						<enum name="Dialing"/>
+						<enum name="Ring"/>
+						<enum name="Ringing"/>
+						<enum name="Up"/>
+						<enum name="Busy"/>
+						<enum name="Dialing Offhook"/>
+						<enum name="Pre-ring"/>
+						<enum name="Unknown"/>
+					</enumlist>
+				</parameter>
+				<parameter name="CallerIDNumRetriever">
+				</parameter>
+				<parameter name="CallerIDNameRetriever">
+				</parameter>
+				<parameter name="ConnectedLineNumRetriever">
+				</parameter>
+				<parameter name="ConnectedLineNameRetriever">
+				</parameter>
+				<parameter name="AccountCodeRetriever">
+				</parameter>
+				<parameter name="ContextRetriever">
+				</parameter>
+				<parameter name="ExtenRetriever">
+				</parameter>
+				<parameter name="PriorityRetriever">
+				</parameter>
+				<parameter name="UniqueidRetriever">
+				</parameter>
+			</syntax>
+		</managerEventInstance>
+	</managerEvent>
  ***/
 
 /*! \brief subscription to the parking lot topic */
@@ -88,7 +245,7 @@
 	timeout = pu->start.tv_sec + (long) pu->time_limit - now.tv_sec;
 	duration = now.tv_sec - pu->start.tv_sec;
 
-	return ast_parked_call_payload_create(event_type, parkee_snapshot, pu->parker, lot_name, pu->parking_space, timeout, duration);
+	return ast_parked_call_payload_create(event_type, parkee_snapshot, pu->parker, pu->retriever, lot_name, pu->parking_space, timeout, duration);
 
 }
 
@@ -99,6 +256,7 @@
 	int res = 0;
 	RAII_VAR(struct ast_str *, parkee_string, NULL, ast_free);
 	RAII_VAR(struct ast_str *, parker_string, NULL, ast_free);
+	RAII_VAR(struct ast_str *, retriever_string, NULL, ast_free);
 
 	if (!out) {
 		return NULL;
@@ -106,10 +264,14 @@
 
 	parkee_string = ast_manager_build_channel_state_string_suffix(payload->parkee, "Parkee");
 	parker_string = ast_manager_build_channel_state_string_suffix(payload->parker, "Parker");
+	if (payload->retriever) {
+		retriever_string = ast_manager_build_channel_state_string_suffix(payload->retriever, "Retriever");
+	}
 
 	res = ast_str_set(&out, 0,
 		"%s" /* parkee channel state */
 		"%s" /* parker channel state */
+		"%s" /* retriever channel state (when available) */
 		"Parkinglot: %s\r\n"
 		"ParkingSpace: %u\r\n"
 		"ParkingTimeout: %lu\r\n"
@@ -117,6 +279,7 @@
 
 		ast_str_buffer(parkee_string),
 		ast_str_buffer(parker_string),
+		retriever_string ? ast_str_buffer(retriever_string) : "",
 		payload->parkinglot,
 		payload->parkingspace,
 		payload->timeout,
@@ -284,7 +447,7 @@
 
 	parked_call_string = manager_build_parked_call_string(parked_call);
 
-	manager_event(EVENT_FLAG_DIALPLAN, event_type,
+	manager_event(EVENT_FLAG_CALL, event_type,
 			"%s",
 			ast_str_buffer(parked_call_string)
 		);

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=385494&r1=385493&r2=385494
==============================================================================
--- team/jrose/bridge_projects/res/parking/res_parking.h (original)
+++ team/jrose/bridge_projects/res/parking/res_parking.h Fri Apr 12 10:26:40 2013
@@ -115,15 +115,16 @@
 };
 
 struct parked_user {
-	struct ast_channel *chan;               /*!< Parked channel */
-	struct ast_channel_snapshot *parker;    /*!< Snapshot of the channel that parked the call at the time of parking */
-	struct timeval start;                   /*!< When the call was parked */
-	int parking_space;                      /*!< Which parking space is used */
-	char comeback[AST_MAX_CONTEXT];         /*!< Where to go on parking timeout */
-	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. */
+	struct ast_channel *chan;                 /*!< Parked channel */
+	struct ast_channel_snapshot *parker;      /*!< Snapshot of the channel that parked the call at the time of parking */
+	struct ast_channel_snapshot *retriever;   /*!< Snapshot of the channel that retrieves a parked call */
+	struct timeval start;                     /*!< When the call was parked */
+	int parking_space;                        /*!< Which parking space is used */
+	char comeback[AST_MAX_CONTEXT];           /*!< Where to go on parking timeout */
+	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