res_pjsip_refer: Fix bugs involving Parking/PJSIP/transfers

PJSIP would never send the final 200 Notify for a blind transfer
when transferring to parking. This patch fixes that. In addition,
it fixes a reference leak when performing blind transfers to
non-bridging extensions.

Review: https://reviewboard.asterisk.org/r/3485/
........

Merged revisions 414400 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414403 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2014-05-22 15:52:30 +00:00
parent 912bbdd1dd
commit d00882108f
12 changed files with 158 additions and 40 deletions

View File

@@ -903,6 +903,22 @@ enum ast_transfer_type {
AST_BRIDGE_TRANSFER_MULTI_PARTY,
};
/*!
* \brief AO2 object that wraps data for transfer_channel_cb
*/
struct transfer_channel_data {
void *data; /*! Data to be used by the transfer_channel_cb -- note that this
* pointer is going to be pointing to something on the stack, so
* it must not be used at any point after returning from the
* transfer_channel_cb. */
int completed; /*! Initially 0, This will be set to 1 by either the transfer
* code or by transfer code hooks (e.g. parking) when the
* transfer is completed and any remaining actions have taken
* place (e.g. parking announcements). It will never be reset
* to 0. This is used for deferring progress for channel
* drivers that support deferred progress. */
};
/*!
* \brief Callback function type called during blind transfers
*
@@ -914,7 +930,7 @@ enum ast_transfer_type {
* \param user_data User-provided data needed in the callback
* \param transfer_type The type of transfer being completed
*/
typedef void (*transfer_channel_cb)(struct ast_channel *chan, void *user_data,
typedef void (*transfer_channel_cb)(struct ast_channel *chan, struct transfer_channel_data *user_data,
enum ast_transfer_type transfer_type);
/*!

View File

@@ -24,6 +24,7 @@
*/
#include "asterisk/stringfields.h"
#include "asterisk/bridge.h"
/*!
* \brief The default parking application that Asterisk expects.
@@ -163,6 +164,8 @@ struct ast_parking_bridge_feature_fn_table {
* \param parker The \ref bridge_channel object that is initiating the parking
* \param context The context to blind transfer to
* \param exten The extension to blind transfer to
* \param parked_channel_cb Execute the following function on the the channel that gets parked
* \param parked_channel_data Data for the parked_channel_cb
*
* \note If the bridge \ref parker is in has more than one other occupant, the entire
* bridge will be parked using a Local channel
@@ -172,7 +175,8 @@ struct ast_parking_bridge_feature_fn_table {
* \retval 0 on success
* \retval non-zero on error
*/
int (* parking_blind_transfer_park)(struct ast_bridge_channel *parker, const char *context, const char *exten);
int (* parking_blind_transfer_park)(struct ast_bridge_channel *parker, const char *context,
const char *exten, transfer_channel_cb parked_channel_cb, struct transfer_channel_data *parked_channel_data);
/*!
* \brief Perform a direct park on a channel in a bridge.
@@ -224,6 +228,9 @@ int ast_parking_park_call(struct ast_bridge_channel *parker, char *exten, size_t
* \param parker The \ref bridge_channel object that is initiating the parking
* \param context The context to blind transfer to
* \param exten The extension to blind transfer to
* \param exten The extension to blind transfer to
* \param parked_channel_cb Execute the following function on the the channel that gets parked
* \param parked_channel_data Data for the parked_channel_cb
*
* \note If the bridge \ref parker is in has more than one other occupant, the entire
* bridge will be parked using a Local channel
@@ -233,7 +240,8 @@ int ast_parking_park_call(struct ast_bridge_channel *parker, char *exten, size_t
* \retval 0 on success
* \retval non-zero on error
*/
int ast_parking_blind_transfer_park(struct ast_bridge_channel *parker, const char *context, const char *exten);
int ast_parking_blind_transfer_park(struct ast_bridge_channel *parker, const char *context,
const char *exten, transfer_channel_cb parked_channel_cb, struct transfer_channel_data *parked_channel_data);
/*!
* \brief Perform a direct park on a channel in a bridge.