[asterisk-commits] mmichelson: branch mmichelson/transfer r386318 - in /team/mmichelson/transfer...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 22 13:51:30 CDT 2013


Author: mmichelson
Date: Mon Apr 22 13:51:26 2013
New Revision: 386318

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386318
Log:
Add initial prototypes and stubs.

The stubs contain a rough sketch about what should happen for each operation.
The attended transfer operation is a bit sketchy at the moment given our goal
of having a single function that masquerades. Thus I will be attacking this
from the perspective of the blind transfer first.


Modified:
    team/mmichelson/transfer/include/asterisk/bridging.h
    team/mmichelson/transfer/main/bridging.c

Modified: team/mmichelson/transfer/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer/include/asterisk/bridging.h?view=diff&rev=386318&r1=386317&r2=386318
==============================================================================
--- team/mmichelson/transfer/include/asterisk/bridging.h (original)
+++ team/mmichelson/transfer/include/asterisk/bridging.h Mon Apr 22 13:51:26 2013
@@ -1212,6 +1212,57 @@
  */
 void ast_bridge_remove_video_src(struct ast_bridge *bridge, struct ast_channel *chan);
 
+enum ast_transfer_result {
+    /*! The transfer completed successfully */
+    AST_TRANSFER_SUCCESS,
+    /*! A bridge involved does not permit transferring */
+    AST_TRANSFER_NOT_PERMITTED,
+    /*! The current bridge setup makes transferring an invalid operation */
+    AST_TRANSFER_INVALID,
+    /*! The transfer operation failed for a miscellaneous reason */
+    AST_TRANSFER_FAIL,
+};
+
+/*!
+ * \brief Blind transfer target to the extension and context provided
+ *
+ * The channel given is bridged to one or multiple channels. Depending on
+ * the bridge and the number of participants, the entire bridge could be
+ * transferred to the given destination, or a single channel may be redirected.
+ *
+ * Callers may provide a frame hook to attach to the new outgoing call. This
+ * can be useful if progress of the resulting blind transfer call is wanted
+ * by the caller of ast_bridge_blind_transfer(). If the transfer fails, then
+ * the hook will not be attached to any call.
+ *
+ * \param transferer The channel performing the blind transfer
+ * \param exten The dialplan extension to send the call to
+ * \param context The dialplan context to send the call to
+ * \param hook A frame hook to attach to the new call
+ * \return The success or failure result of the blind transfer
+ */
+enum ast_transfer_result ast_bridge_blind_transfer(struct ast_channel *transferer,
+		const char *exten, const char *context, struct ast_framehook *hook)
+
+/*!
+ * \brief Attended transfer
+ *
+ * The two channels are both transferer channels. The first is the channel
+ * that is bridged to the transferee (or if unbridged, the 'first' call of
+ * the transfer). The second is the channel that is bridged to the transfer
+ * target (or if unbridged, the 'second' call of the transfer).
+ *
+ * Like with a blind transfer, a frame hook can be provided to monitor the
+ * resulting call after the transfer completes. If the transfer fails, the
+ * hook will not be attached to any call.
+ *
+ * \param to_transferee Transferer channel on initial call (presumably bridged to transferee)
+ * \param to_transfer_target Transferer channel on consultation call (presumably bridged to transfer target)
+ * \param hook A frame hook to attach to the resultant call
+ * \return The success or failure of the attended transfer
+ */
+enum ast_transfer_result ast_bridge_attended_transfer(struct ast_channel *to_transferee,
+		struct ast_channel *to_transfer_target, struct ast_framehook *hook)
 /*!
  * \brief Set channel to goto specific location after the bridge.
  * \since 12.0.0

Modified: team/mmichelson/transfer/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer/main/bridging.c?view=diff&rev=386318&r1=386317&r2=386318
==============================================================================
--- team/mmichelson/transfer/main/bridging.c (original)
+++ team/mmichelson/transfer/main/bridging.c Mon Apr 22 13:51:26 2013
@@ -4189,6 +4189,48 @@
 	ast_bridge_unlock(bridge);
 }
 
+enum ast_transfer_result ast_bridge_blind_transfer(struct ast_channel *transferer,
+		const char *exten, const char *context, struct ast_framehook *hook)
+{
+	/* First, ensure that the transferer is actually in a bridge. If not, return AST_TRANSFER_INVALID.
+	 * Second, ensure that the bridge the transferer is in is capable of transfers. If not, return AST_TRANSFER_NOT_PERMITTED
+	 * Third, check if the bridge in use requires transferring the bridge.
+	 *     If the bridge requires it, then perform the local channel swap method of blind transferring
+	 *     If the bridge does not require it, then check the number of bridged participants.
+	 *         If there is only one participant, then use an ast_async_goto() on the bridged participant
+	 *         If there are multiple participants, then perform the local channel swap method of blind transferring
+	 * If any of the steps above fails, then return AST_TRANSFER_FAIL
+	 * Otherwise, return AST_TRANSFER_SUCCESS.
+	 */
+
+	/* XXX STUB */
+	return AST_TRANSFER_SUCCESS;
+}
+
+enum ast_transfer_result ast_bridge_attended_transfer(struct ast_channel *to_transferee,
+		struct ast_channel *to_transfer_target, struct ast_framehook *hook)
+{
+	/* First, check the validity of scenario. If invalid, return AST_TRANSFER_INVALID. The following are invalid:
+	 *     1) atxfer of an unbridged call to an unbridged call
+	 *     2) atxfer of an unbridged call to a multi-party (n > 2) bridge
+	 *     3) atxfer of a multi-party (n > 2) bridge to an unbridged call
+	 * Second, check that the bridge(s) involved allows transfers. If not, return AST_TRANSFER_NOT_PERMITTED.
+	 * Third, break into different scenarios for different bridge situations:
+	 * If both channels are bridged, perform a bridge merge. Direction of the merge is TBD.
+	 * If channel A is bridged, and channel B is not (e.g. transferring to IVR or blond transfer)
+	 *     Some manner of masquerading is necessary. Presumably, you'd want to move channel A's bridge peer
+	 *     into where channel B is. However, it may be possible to do something a bit different, where a
+	 *     local channel is created and put into channel A's bridge. The local channel's ;2 channel
+	 *     is then masqueraded with channel B in some way.
+	 * If channel A is not bridged and channel B is, then:
+	 *     This is similar to what is done in the previous scenario. Create a local channel and place it
+	 *     into B's bridge. Then masquerade the ;2 leg of the local channel.
+	 */
+
+	/* XXX STUB */
+	return AST_TRANSFER_SUCCESS;
+}
+
 /*!
  * \internal
  * \brief Service the bridge manager request.




More information about the asterisk-commits mailing list