[asterisk-commits] mmichelson: branch mmichelson/transfer_stasis r391548 - in /team/mmichelson/t...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 12 10:58:55 CDT 2013
Author: mmichelson
Date: Wed Jun 12 10:58:50 2013
New Revision: 391548
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391548
Log:
Add an extra parameter to ast_bridge_transfer_blind().
This parameter indicates whether the transfer comes externally. Native
transfers (such as SIP REFER) and AMI transfers are considered "external"
while DTMF-initiated transfers are considered "internal".
This change changes all instances of "is_native" to "is_external" since it's
more clear what is meant. It also clears up the question of how an AMI-initiated
blind transfer is classified.
Modified:
team/mmichelson/transfer_stasis/bridges/bridge_builtin_features.c
team/mmichelson/transfer_stasis/channels/chan_iax2.c
team/mmichelson/transfer_stasis/channels/chan_sip.c
team/mmichelson/transfer_stasis/channels/chan_skinny.c
team/mmichelson/transfer_stasis/include/asterisk/bridging.h
team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h
team/mmichelson/transfer_stasis/main/bridging.c
team/mmichelson/transfer_stasis/main/manager.c
team/mmichelson/transfer_stasis/main/stasis_bridging.c
Modified: team/mmichelson/transfer_stasis/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/bridges/bridge_builtin_features.c?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/bridges/bridge_builtin_features.c (original)
+++ team/mmichelson/transfer_stasis/bridges/bridge_builtin_features.c Wed Jun 12 10:58:50 2013
@@ -218,7 +218,7 @@
ast_after_bridge_set_go_on(bridge_channel->chan, NULL, NULL, 0, goto_on_blindxfr);
}
- if (ast_bridge_transfer_blind(bridge_channel->chan, exten, context, blind_transfer_cb,
+ if (ast_bridge_transfer_blind(0, bridge_channel->chan, exten, context, blind_transfer_cb,
bridge_channel->chan) != AST_BRIDGE_TRANSFER_SUCCESS &&
!ast_strlen_zero(goto_on_blindxfr)) {
ast_after_bridge_goto_discard(bridge_channel->chan);
Modified: team/mmichelson/transfer_stasis/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/channels/chan_iax2.c?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/channels/chan_iax2.c (original)
+++ team/mmichelson/transfer_stasis/channels/chan_iax2.c Wed Jun 12 10:58:50 2013
@@ -10666,7 +10666,7 @@
ast_channel_unlock(owner);
ast_mutex_unlock(&iaxsl[fr->callno]);
- if (ast_bridge_transfer_blind(owner, ies.called_number,
+ if (ast_bridge_transfer_blind(1, owner, ies.called_number,
context, NULL, NULL) != AST_BRIDGE_TRANSFER_SUCCESS) {
ast_log(LOG_WARNING, "Blind transfer of '%s' to '%s@%s' failed\n",
ast_channel_name(owner), ies.called_number,
Modified: team/mmichelson/transfer_stasis/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/channels/chan_sip.c?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/channels/chan_sip.c (original)
+++ team/mmichelson/transfer_stasis/channels/chan_sip.c Wed Jun 12 10:58:50 2013
@@ -26214,7 +26214,7 @@
}
sip_pvt_unlock(p);
- transfer_res = ast_bridge_transfer_blind(transferer, refer_to, refer_to_context, blind_transfer_cb, &cb_data);
+ transfer_res = ast_bridge_transfer_blind(1, transferer, refer_to, refer_to_context, blind_transfer_cb, &cb_data);
sip_pvt_lock(p);
switch (transfer_res) {
Modified: team/mmichelson/transfer_stasis/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/channels/chan_skinny.c?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/channels/chan_skinny.c (original)
+++ team/mmichelson/transfer_stasis/channels/chan_skinny.c Wed Jun 12 10:58:50 2013
@@ -5274,7 +5274,7 @@
xferee->related = NULL;
ast_queue_control(xferee->owner, AST_CONTROL_UNHOLD);
- res = ast_bridge_transfer_blind(xferee->owner, sub->exten, sub->line->context, NULL, NULL);
+ res = ast_bridge_transfer_blind(1, xferee->owner, sub->exten, sub->line->context, NULL, NULL);
if (res != AST_BRIDGE_TRANSFER_SUCCESS) {
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d failed to blind transfer %d to '%s'@'%s' - %d\n",
Modified: team/mmichelson/transfer_stasis/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/include/asterisk/bridging.h?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/include/asterisk/bridging.h (original)
+++ team/mmichelson/transfer_stasis/include/asterisk/bridging.h Wed Jun 12 10:58:50 2013
@@ -1436,6 +1436,7 @@
* \note Absolutely _NO_ channel locks should be held before
* calling this function.
*
+ * \param is_native Indicates that native protocol messages are used to perform the transfer
* \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
@@ -1444,8 +1445,8 @@
* \param user_data Argument for new_channel_cb
* \return The success or failure result of the blind transfer
*/
-enum ast_transfer_result ast_bridge_transfer_blind(struct ast_channel *transferer,
- const char *exten, const char *context,
+enum ast_transfer_result ast_bridge_transfer_blind(int is_native,
+ struct ast_channel *transferer, const char *exten, const char *context,
transfer_channel_cb new_channel_cb, void *user_data);
/*!
Modified: team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h (original)
+++ team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h Wed Jun 12 10:58:50 2013
@@ -236,7 +236,7 @@
/*! Result of the blind transfer */
enum ast_transfer_result result;
/*! If 0, was core DTMF transfer, otherwise was a native transfer */
- int is_native;
+ int is_external;
/*! The transferer and its bridge before starting the transfer*/
struct ast_bridge_channel_snapshot_pair transferer;
};
@@ -252,13 +252,13 @@
/*!
* \brief Publish a blind transfer event
*
- * \param is_native Whether the blind transfer is a native blind transfer
+ * \param is_external Whether the blind transfer is a native blind transfer
* \param result The success or failure of the transfer
* \param to_transferee The bridge between the transferer and transferee plus the transferer channel
* \param context The destination context for the blind transfer
* \param exten The destination extension for the blind transfer
*/
-void ast_bridge_publish_blind_transfer(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_blind_transfer(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *to_transferee, const char *context, const char *exten);
enum ast_attended_transfer_dest_type {
@@ -279,7 +279,7 @@
/*! Result of the blind transfer */
enum ast_transfer_result result;
/*! Indicates if the transfer was performed using a native protocol */
- int is_native;
+ int is_external;
/*! Bridge between transferer <-> transferee and the transferer channel in that bridge. May be NULL */
struct ast_bridge_channel_snapshot_pair to_transferee;
/*! Bridge between transferer <-> transfer target and the transferer channel in that bridge. May be NULL */
@@ -316,12 +316,12 @@
* Publish an \ref ast_attended_transfer_message with the dest_type set to
* \c AST_ATTENDED_TRANSFER_DEST_FAIL.
*
- * \param is_native Indicates if the transfer was performed natively
+ * \param is_external Indicates if the transfer was performed natively
* \param result The result of the transfer. Will always be a type of failure.
* \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge
* \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge
*/
-void ast_bridge_publish_attended_transfer_fail(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_attended_transfer_fail(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target);
/*!
@@ -337,13 +337,13 @@
*
* In either case, two bridges enter, one leaves.
*
- * \param is_native Indicates if the transfer was performed natively
+ * \param is_external Indicates if the transfer was performed natively
* \param result The result of the transfer. Will always be a type of failure.
* \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge
* \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge
* \param final_bridge The bridge that the parties end up in. Will be a bridge from the transferee or target pair.
*/
-void ast_bridge_publish_attended_transfer_bridge_merge(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_attended_transfer_bridge_merge(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target,
struct ast_bridge *final_bridge);
@@ -358,13 +358,13 @@
* \li A transferee channel leaving a bridge to run an app
* \li A bridge of transferees running an app (via a local channel)
*
- * \param is_native Indicates if the transfer was performed natively
+ * \param is_external Indicates if the transfer was performed natively
* \param result The result of the transfer. Will always be a type of failure.
* \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge
* \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge
* \param dest_app The application that the channel or bridge is running upon transfer completion.
*/
-void ast_bridge_publish_attended_transfer_app(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_attended_transfer_app(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target,
const char *dest_app);
@@ -381,13 +381,13 @@
* When this type of transfer occurs, the two bridges continue to exist after the
* transfer and a local channel is used to link the two bridges together.
*
- * \param is_native Indicates if the transfer was performed natively
+ * \param is_external Indicates if the transfer was performed natively
* \param result The result of the transfer. Will always be a type of failure.
* \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge
* \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge
* \param locals The local channels linking the bridges together along with the bridge that each local channel belongs to.
*/
-void ast_bridge_publish_attended_transfer_link(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_attended_transfer_link(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target,
struct ast_bridge_channel_pair *locals[2]);
Modified: team/mmichelson/transfer_stasis/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/bridging.c?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/main/bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/bridging.c Wed Jun 12 10:58:50 2013
@@ -5947,18 +5947,18 @@
return bridge;
}
-static void publish_blind_transfer(int is_native, enum ast_transfer_result result,
+static void publish_blind_transfer(int is_external, enum ast_transfer_result result,
struct ast_channel *transferer, struct ast_bridge *bridge,
const char *context, const char *exten)
{
struct ast_bridge_channel_pair pair;
pair.channel = transferer;
pair.bridge = bridge;
- ast_bridge_publish_blind_transfer(1, result, &pair, context, exten);
-}
-
-enum ast_transfer_result ast_bridge_transfer_blind(struct ast_channel *transferer,
- const char *exten, const char *context,
+ ast_bridge_publish_blind_transfer(is_external, result, &pair, context, exten);
+}
+
+enum ast_transfer_result ast_bridge_transfer_blind(int is_external,
+ struct ast_channel *transferer, const char *exten, const char *context,
transfer_channel_cb new_channel_cb, void *user_data)
{
RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
@@ -6049,8 +6049,7 @@
transfer_result = AST_BRIDGE_TRANSFER_SUCCESS;
publish:
- /* XXX is_native parameter cannot be determined with current API */
- publish_blind_transfer(1, transfer_result, transferer, bridge, context, exten);
+ publish_blind_transfer(is_external, transfer_result, transferer, bridge, context, exten);
return transfer_result;
}
Modified: team/mmichelson/transfer_stasis/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/manager.c?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/main/manager.c (original)
+++ team/mmichelson/transfer_stasis/main/manager.c Wed Jun 12 10:58:50 2013
@@ -4060,7 +4060,7 @@
context = ast_channel_context(chan);
}
- switch (ast_bridge_transfer_blind(chan, exten, context, NULL, NULL)) {
+ switch (ast_bridge_transfer_blind(1, chan, exten, context, NULL, NULL)) {
case AST_BRIDGE_TRANSFER_NOT_PERMITTED:
astman_send_error(s, m, "Transfer not permitted");
break;
Modified: team/mmichelson/transfer_stasis/main/stasis_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/stasis_bridging.c?view=diff&rev=391548&r1=391547&r2=391548
==============================================================================
--- team/mmichelson/transfer_stasis/main/stasis_bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/stasis_bridging.c Wed Jun 12 10:58:50 2013
@@ -358,7 +358,7 @@
bridge_channel_snapshot_pair_cleanup(&msg->transferer);
}
-static struct ast_blind_transfer_message *blind_transfer_message_create(int is_native,
+static struct ast_blind_transfer_message *blind_transfer_message_create(int is_external,
enum ast_transfer_result result, struct ast_bridge_channel_pair *transferer,
const char *context, const char *exten)
{
@@ -375,20 +375,20 @@
ast_string_field_set(msg, context, context);
ast_string_field_set(msg, exten, exten);
- msg->is_native = is_native;
+ msg->is_external = is_external;
msg->result = result;
ao2_ref(msg, +1);
return msg;
}
-void ast_bridge_publish_blind_transfer(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_blind_transfer(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferer, const char *context, const char *exten)
{
RAII_VAR(struct ast_blind_transfer_message *, transfer_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- transfer_msg = blind_transfer_message_create(is_native, result, transferer, context, exten);
+ transfer_msg = blind_transfer_message_create(is_external, result, transferer, context, exten);
if (!transfer_msg) {
return;
}
@@ -418,7 +418,7 @@
}
}
-static struct ast_attended_transfer_message *attended_transfer_message_create(int is_native, enum ast_transfer_result result,
+static struct ast_attended_transfer_message *attended_transfer_message_create(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target)
{
RAII_VAR(struct ast_attended_transfer_message *, msg, NULL, ao2_cleanup);
@@ -433,20 +433,20 @@
return NULL;
}
- msg->is_native = is_native;
+ msg->is_external = is_external;
msg->result = result;
ao2_ref(msg, +1);
return msg;
}
-void ast_bridge_publish_attended_transfer_fail(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_attended_transfer_fail(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target)
{
RAII_VAR(struct ast_attended_transfer_message *, transfer_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- transfer_msg = attended_transfer_message_create(is_native, result, transferee, target);
+ transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;
}
@@ -461,14 +461,14 @@
stasis_publish(ast_bridge_topic_all(), msg);
}
-void ast_bridge_publish_attended_transfer_bridge_merge(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_attended_transfer_bridge_merge(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target,
struct ast_bridge *final_bridge)
{
RAII_VAR(struct ast_attended_transfer_message *, transfer_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- transfer_msg = attended_transfer_message_create(is_native, result, transferee, target);
+ transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;
}
@@ -485,14 +485,14 @@
stasis_publish(ast_bridge_topic_all(), msg);
}
-void ast_bridge_publish_attended_transfer_app(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_attended_transfer_app(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target,
const char *dest_app)
{
RAII_VAR(struct ast_attended_transfer_message *, transfer_msg, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- transfer_msg = attended_transfer_message_create(is_native, result, transferee, target);
+ transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;
}
@@ -508,7 +508,7 @@
stasis_publish(ast_bridge_topic_all(), msg);
}
-void ast_bridge_publish_attended_transfer_link(int is_native, enum ast_transfer_result result,
+void ast_bridge_publish_attended_transfer_link(int is_external, enum ast_transfer_result result,
struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target,
struct ast_bridge_channel_pair *locals[2])
{
@@ -516,7 +516,7 @@
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
int i;
- transfer_msg = attended_transfer_message_create(is_native, result, transferee, target);
+ transfer_msg = attended_transfer_message_create(is_external, result, transferee, target);
if (!transfer_msg) {
return;
}
More information about the asterisk-commits
mailing list