[asterisk-commits] dlee: branch dlee/ASTERISK-22451-ari-subscribe r399156 - in /team/dlee/ASTERI...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Sep 16 09:52:31 CDT 2013
Author: dlee
Date: Mon Sep 16 09:52:24 2013
New Revision: 399156
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399156
Log:
Merged revisions 399100-399146 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
team/dlee/ASTERISK-22451-ari-subscribe/ (props changed)
team/dlee/ASTERISK-22451-ari-subscribe/apps/app_agent_pool.c
team/dlee/ASTERISK-22451-ari-subscribe/apps/confbridge/conf_chan_announce.c
team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c
team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge.h
team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge_channel.h
team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/features.h
team/dlee/ASTERISK-22451-ari-subscribe/main/astobj2.c
team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c
team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_basic.c
team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_channel.c
team/dlee/ASTERISK-22451-ari-subscribe/main/cdr.c
team/dlee/ASTERISK-22451-ari-subscribe/main/channel.c
team/dlee/ASTERISK-22451-ari-subscribe/main/core_local.c
team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c
team/dlee/ASTERISK-22451-ari-subscribe/main/features.c
team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_applications.c
team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_bridge_features.c
team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_tests.c
team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_refer.c
team/dlee/ASTERISK-22451-ari-subscribe/res/stasis/control.c
team/dlee/ASTERISK-22451-ari-subscribe/tests/test_cdr.c
team/dlee/ASTERISK-22451-ari-subscribe/tests/test_cel.c
Propchange: team/dlee/ASTERISK-22451-ari-subscribe/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/dlee/ASTERISK-22451-ari-subscribe/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Sep 16 09:52:24 2013
@@ -1,1 +1,1 @@
-/branches/12:1-399084
+/branches/12:1-399155
Modified: team/dlee/ASTERISK-22451-ari-subscribe/apps/app_agent_pool.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/apps/app_agent_pool.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/apps/app_agent_pool.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/apps/app_agent_pool.c Mon Sep 16 09:52:24 2013
@@ -1509,7 +1509,8 @@
* want to put the agent back into the holding bridge for the
* next caller.
*/
- ast_bridge_join(holding, logged, NULL, &features, NULL, 1);
+ ast_bridge_join(holding, logged, NULL, &features, NULL,
+ AST_BRIDGE_JOIN_PASS_REFERENCE);
if (logged != agent->logged) {
/* This channel is no longer the logged in agent. */
break;
@@ -1890,7 +1891,8 @@
}
ast_indicate(chan, AST_CONTROL_RINGING);
- ast_bridge_join(caller_bridge, chan, NULL, &caller_features, NULL, 1);
+ ast_bridge_join(caller_bridge, chan, NULL, &caller_features, NULL,
+ AST_BRIDGE_JOIN_PASS_REFERENCE);
ast_bridge_features_cleanup(&caller_features);
return -1;
Modified: team/dlee/ASTERISK-22451-ari-subscribe/apps/confbridge/conf_chan_announce.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/apps/confbridge/conf_chan_announce.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/apps/confbridge/conf_chan_announce.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/apps/confbridge/conf_chan_announce.c Mon Sep 16 09:52:24 2013
@@ -196,7 +196,8 @@
ast_set_flag(&features->feature_flags, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE);
/* Impart the output channel into the bridge */
- if (ast_bridge_impart(p->bridge, chan, NULL, features, 0)) {
+ if (ast_bridge_impart(p->bridge, chan, NULL, features,
+ AST_BRIDGE_IMPART_CHAN_DEPARTABLE)) {
ast_bridge_features_destroy(features);
ast_channel_unref(chan);
return -1;
Modified: team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/channels/chan_sip.c Mon Sep 16 09:52:24 2013
@@ -24986,7 +24986,8 @@
ast_channel_unlock(replaces_chan);
if (bridge) {
- if (ast_bridge_impart(bridge, c, replaces_chan, NULL, 1)) {
+ if (ast_bridge_impart(bridge, c, replaces_chan, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
ast_hangup(c);
}
} else {
Modified: team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge.h?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge.h (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge.h Mon Sep 16 09:52:24 2013
@@ -422,6 +422,13 @@
*/
void ast_bridge_notify_masquerade(struct ast_channel *chan);
+enum ast_bridge_join_flags {
+ /*! The bridge reference is being passed by the caller. */
+ AST_BRIDGE_JOIN_PASS_REFERENCE = (1 << 0),
+ /*! The initial bridge join does not cause a COLP exchange. */
+ AST_BRIDGE_JOIN_INHIBIT_JOIN_COLP = (1 << 1),
+};
+
/*!
* \brief Join (blocking) a channel to a bridge
*
@@ -430,7 +437,7 @@
* \param swap Channel to swap out if swapping
* \param features Bridge features structure
* \param tech_args Optional Bridging tech optimization parameters for this channel.
- * \param pass_reference TRUE if the bridge reference is being passed by the caller.
+ * \param flags defined by enum ast_bridge_join_flags.
*
* \note Absolutely _NO_ locks should be held before calling
* this function since it blocks.
@@ -441,7 +448,7 @@
* Example usage:
*
* \code
- * ast_bridge_join(bridge, chan, NULL, NULL, NULL, 0);
+ * ast_bridge_join(bridge, chan, NULL, NULL, NULL, AST_BRIDGE_JOIN_PASS_REFERENCE);
* \endcode
*
* This adds a channel pointed to by the chan pointer to the bridge pointed to by
@@ -460,7 +467,18 @@
struct ast_channel *swap,
struct ast_bridge_features *features,
struct ast_bridge_tech_optimizations *tech_args,
- int pass_reference);
+ enum ast_bridge_join_flags flags);
+
+enum ast_bridge_impart_flags {
+ /*! Field describing what the caller can do with the channel after it is imparted. */
+ AST_BRIDGE_IMPART_CHAN_MASK = (1 << 0),
+ /*! The caller wants to reclaim the channel using ast_bridge_depart(). */
+ AST_BRIDGE_IMPART_CHAN_DEPARTABLE = (0 << 0),
+ /*! The caller is passing channel control entirely to the bridging system. */
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT = (1 << 0),
+ /*! The initial bridge join does not cause a COLP exchange. */
+ AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP = (1 << 1),
+};
/*!
* \brief Impart (non-blocking) a channel onto a bridge
@@ -469,7 +487,7 @@
* \param chan Channel to impart (The channel reference is stolen if impart successful.)
* \param swap Channel to swap out if swapping. NULL if not swapping.
* \param features Bridge features structure.
- * \param independent TRUE if caller does not want to reclaim the channel using ast_bridge_depart().
+ * \param flags defined by enum ast_bridge_impart_flags.
*
* \note The features parameter must be NULL or obtained by
* ast_bridge_features_new(). You must not dereference features
@@ -478,12 +496,12 @@
* \note chan is locked by this function.
*
* \retval 0 on success
- * \retval -1 on failure
+ * \retval -1 on failure (Caller still has ownership of chan)
*
* Example usage:
*
* \code
- * ast_bridge_impart(bridge, chan, NULL, NULL, 0);
+ * ast_bridge_impart(bridge, chan, NULL, NULL, AST_BRIDGE_IMPART_CHAN_INDEPENDENT);
* \endcode
*
* \details
@@ -501,20 +519,26 @@
* features structure can be specified in the features
* parameter.
*
- * \note If you impart a channel as not independent you MUST
+ * \note If you impart a channel with
+ * AST_BRIDGE_IMPART_CHAN_DEPARTABLE you MUST
* ast_bridge_depart() the channel if this call succeeds. The
* bridge channel thread is created join-able. The implication
* is that the channel is special and will not behave like a
* normal channel.
*
- * \note If you impart a channel as independent you must not
+ * \note If you impart a channel with
+ * AST_BRIDGE_IMPART_CHAN_INDEPENDENT you must not
* ast_bridge_depart() the channel. The bridge channel thread
* is created non-join-able. The channel must be treated as if
* it were placed into the bridge by ast_bridge_join().
* Channels placed into a bridge by ast_bridge_join() are
* removed by a third party using ast_bridge_remove().
*/
-int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, int independent);
+int ast_bridge_impart(struct ast_bridge *bridge,
+ struct ast_channel *chan,
+ struct ast_channel *swap,
+ struct ast_bridge_features *features,
+ enum ast_bridge_impart_flags flags) attribute_warn_unused_result;
/*!
* \brief Depart a channel from a bridge
Modified: team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge_channel.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge_channel.h?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge_channel.h (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/bridge_channel.h Mon Sep 16 09:52:24 2013
@@ -122,6 +122,8 @@
unsigned int just_joined:1;
/*! TRUE if the channel is suspended from the bridge. */
unsigned int suspended:1;
+ /*! TRUE if the COLP update on initial join is inhibited. */
+ unsigned int inhibit_colp:1;
/*! TRUE if the channel must wait for an ast_bridge_depart to reclaim the channel. */
unsigned int depart_wait:1;
/* ^-- These flags change while the bridge is locked or before the channel is in the bridge. */
Modified: team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/features.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/features.h?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/features.h (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/include/asterisk/features.h Mon Sep 16 09:52:24 2013
@@ -39,8 +39,14 @@
AST_FEATURE_FLAG_BYBOTH = (3 << 3),
};
-/*! \brief Bridge a call, optionally allowing redirection */
-int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer,struct ast_bridge_config *config);
+/*!
+ * \brief Bridge a call, optionally allowing redirection
+ *
+ * \note The function caller is assumed to have already done the
+ * COLP exchange for the initial bridging of the two channels if
+ * it was desired.
+ */
+int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config);
/*!
* \brief Bridge a call, and add additional flags to the bridge
@@ -53,6 +59,10 @@
* \param peer The called channel
* \param config Bridge configuration for the channels
* \param flags Additional flags to set on the created bridge
+ *
+ * \note The function caller is assumed to have already done the
+ * COLP exchange for the initial bridging of the two channels if
+ * it was desired.
*/
int ast_bridge_call_with_flags(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, unsigned int flags);
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/astobj2.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/astobj2.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/astobj2.c Mon Sep 16 09:52:24 2013
@@ -3190,7 +3190,8 @@
num_buckets = hash_fn ? n_buckets : 1;
container_size = sizeof(struct ao2_container_hash) + num_buckets * sizeof(struct hash_bucket);
- self = __ao2_alloc_debug(container_size, container_destruct_debug, ao2_options,
+ self = __ao2_alloc_debug(container_size,
+ ref_debug ? container_destruct_debug : container_destruct, ao2_options,
tag, file, line, func, ref_debug);
return hash_ao2_container_init(self, container_options, num_buckets, hash_fn,
sort_fn, cmp_fn);
@@ -5337,7 +5338,8 @@
return NULL;
}
- self = __ao2_alloc_debug(sizeof(*self), container_destruct_debug, ao2_options,
+ self = __ao2_alloc_debug(sizeof(*self),
+ ref_debug ? container_destruct_debug : container_destruct, ao2_options,
tag, file, line, func, ref_debug);
return rb_ao2_container_init(self, container_options, sort_fn, cmp_fn);
}
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/bridge.c Mon Sep 16 09:52:24 2013
@@ -1433,13 +1433,13 @@
struct ast_channel *swap,
struct ast_bridge_features *features,
struct ast_bridge_tech_optimizations *tech_args,
- int pass_reference)
+ enum ast_bridge_join_flags flags)
{
struct ast_bridge_channel *bridge_channel;
int res = 0;
bridge_channel = bridge_channel_internal_alloc(bridge);
- if (pass_reference) {
+ if (flags & AST_BRIDGE_JOIN_PASS_REFERENCE) {
ao2_ref(bridge, -1);
}
if (!bridge_channel) {
@@ -1468,6 +1468,7 @@
bridge_channel->chan = chan;
bridge_channel->swap = swap;
bridge_channel->features = features;
+ bridge_channel->inhibit_colp = !!(flags & AST_BRIDGE_JOIN_INHIBIT_JOIN_COLP);
if (!res) {
res = bridge_channel_internal_join(bridge_channel);
@@ -1546,7 +1547,11 @@
return NULL;
}
-int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, int independent)
+int ast_bridge_impart(struct ast_bridge *bridge,
+ struct ast_channel *chan,
+ struct ast_channel *swap,
+ struct ast_bridge_features *features,
+ enum ast_bridge_impart_flags flags)
{
int res = 0;
struct ast_bridge_channel *bridge_channel;
@@ -1585,12 +1590,14 @@
bridge_channel->chan = chan;
bridge_channel->swap = swap;
bridge_channel->features = features;
- bridge_channel->depart_wait = independent ? 0 : 1;
+ bridge_channel->inhibit_colp = !!(flags & AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP);
+ bridge_channel->depart_wait =
+ (flags & AST_BRIDGE_IMPART_CHAN_MASK) == AST_BRIDGE_IMPART_CHAN_DEPARTABLE;
bridge_channel->callid = ast_read_threadstorage_callid();
/* Actually create the thread that will handle the channel */
if (!res) {
- if (independent) {
+ if ((flags & AST_BRIDGE_IMPART_CHAN_MASK) == AST_BRIDGE_IMPART_CHAN_INDEPENDENT) {
res = ast_pthread_create_detached(&bridge_channel->thread, NULL,
bridge_channel_ind_thread, bridge_channel);
} else {
@@ -2191,7 +2198,8 @@
ast_answer(yanked_chan);
}
ast_channel_ref(yanked_chan);
- if (ast_bridge_impart(bridge, yanked_chan, NULL, features, 1)) {
+ if (ast_bridge_impart(bridge, yanked_chan, NULL, features,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
/* It is possible for us to yank a channel and have some other
* thread start a PBX on the channl after we yanked it. In particular,
* this can theoretically happen on the ;2 of a Local channel if we
@@ -3638,7 +3646,8 @@
ast_hangup(local);
return AST_BRIDGE_TRANSFER_FAIL;
}
- if (ast_bridge_impart(bridge, local, transferer, NULL, 1)) {
+ if (ast_bridge_impart(bridge, local, transferer, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
ast_hangup(local);
return AST_BRIDGE_TRANSFER_FAIL;
}
@@ -3808,7 +3817,8 @@
return AST_BRIDGE_TRANSFER_FAIL;
}
- if (ast_bridge_impart(bridge1, local_chan, chan1, NULL, 1)) {
+ if (ast_bridge_impart(bridge1, local_chan, chan1, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
ast_hangup(local_chan);
return AST_BRIDGE_TRANSFER_FAIL;
}
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_basic.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_basic.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_basic.c Mon Sep 16 09:52:24 2013
@@ -2289,7 +2289,8 @@
*/
ast_bridge_features_ds_set(props->recall_target, &props->transferer_features);
ast_channel_ref(props->recall_target);
- if (ast_bridge_impart(props->transferee_bridge, props->recall_target, NULL, NULL, 1)) {
+ if (ast_bridge_impart(props->transferee_bridge, props->recall_target, NULL, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
ast_hangup(props->recall_target);
return TRANSFER_FAIL;
}
@@ -2380,7 +2381,8 @@
}
ast_channel_ref(props->recall_target);
- if (ast_bridge_impart(props->transferee_bridge, props->recall_target, NULL, NULL, 1)) {
+ if (ast_bridge_impart(props->transferee_bridge, props->recall_target, NULL, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
ast_log(LOG_ERROR, "Unable to place recall target into bridge\n");
ast_hangup(props->recall_target);
return -1;
@@ -3067,7 +3069,8 @@
* choice is to give it a bump
*/
ast_channel_ref(props->transfer_target);
- if (ast_bridge_impart(props->target_bridge, props->transfer_target, NULL, NULL, 1)) {
+ if (ast_bridge_impart(props->target_bridge, props->transfer_target, NULL, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
ast_log(LOG_ERROR, "Unable to place transfer target into bridge.\n");
ast_stream_and_wait(bridge_channel->chan, props->failsound, AST_DIGIT_NONE);
ast_bridge_channel_write_unhold(bridge_channel);
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_channel.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_channel.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/bridge_channel.c Mon Sep 16 09:52:24 2013
@@ -2000,7 +2000,7 @@
BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, bridge_channel->bridge->cause);
res = -1;
}
- bridge_reconfigured(bridge_channel->bridge, 1);
+ bridge_reconfigured(bridge_channel->bridge, !bridge_channel->inhibit_colp);
if (bridge_channel->state == BRIDGE_CHANNEL_STATE_WAIT) {
/*
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/cdr.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/cdr.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/cdr.c Mon Sep 16 09:52:24 2013
@@ -2578,6 +2578,10 @@
return;
}
+ if (filter_channel_snapshot(channel)) {
+ return;
+ }
+
CDR_DEBUG(mod_cfg, "Bridge Enter message for channel %s: %u.%08u\n",
channel->name,
(unsigned int)stasis_message_timestamp(message)->tv_sec,
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/channel.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/channel.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/channel.c Mon Sep 16 09:52:24 2013
@@ -4380,6 +4380,89 @@
}
}
+/*!
+ * \internal
+ * \brief Preprocess connected line update.
+ * \since 12.0.0
+ *
+ * \param chan channel to change the indication
+ * \param data pointer to payload data
+ * \param datalen size of payload data
+ *
+ * \note This function assumes chan is locked.
+ *
+ * \retval 0 keep going.
+ * \retval -1 quit now.
+ */
+static int indicate_connected_line(struct ast_channel *chan, const void *data, size_t datalen)
+{
+ struct ast_party_connected_line *chan_connected = ast_channel_connected(chan);
+ struct ast_party_connected_line *chan_indicated = ast_channel_connected_indicated(chan);
+ struct ast_party_connected_line connected;
+ unsigned char current[1024];
+ unsigned char proposed[1024];
+ int current_size;
+ int proposed_size;
+ int res;
+
+ ast_party_connected_line_set_init(&connected, chan_connected);
+ res = ast_connected_line_parse_data(data, datalen, &connected);
+ if (!res) {
+ ast_channel_set_connected_line(chan, &connected, NULL);
+ }
+ ast_party_connected_line_free(&connected);
+ if (res) {
+ return -1;
+ }
+
+ current_size = ast_connected_line_build_data(current, sizeof(current),
+ chan_indicated, NULL);
+ proposed_size = ast_connected_line_build_data(proposed, sizeof(proposed),
+ chan_connected, NULL);
+ if (current_size == -1 || proposed_size == -1) {
+ return -1;
+ }
+
+ if (current_size == proposed_size && !memcmp(current, proposed, current_size)) {
+ ast_debug(1, "%s: Dropping redundant connected line update \"%s\" <%s>.\n",
+ ast_channel_name(chan),
+ S_COR(chan_connected->id.name.valid, chan_connected->id.name.str, ""),
+ S_COR(chan_connected->id.number.valid, chan_connected->id.number.str, ""));
+ return -1;
+ }
+
+ ast_party_connected_line_copy(chan_indicated, chan_connected);
+ return 0;
+}
+
+/*!
+ * \internal
+ * \brief Preprocess redirecting update.
+ * \since 12.0.0
+ *
+ * \param chan channel to change the indication
+ * \param data pointer to payload data
+ * \param datalen size of payload data
+ *
+ * \note This function assumes chan is locked.
+ *
+ * \retval 0 keep going.
+ * \retval -1 quit now.
+ */
+static int indicate_redirecting(struct ast_channel *chan, const void *data, size_t datalen)
+{
+ struct ast_party_redirecting redirecting;
+ int res;
+
+ ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(chan));
+ res = ast_redirecting_parse_data(data, datalen, &redirecting);
+ if (!res) {
+ ast_channel_set_redirecting(chan, &redirecting, NULL);
+ }
+ ast_party_redirecting_free(&redirecting);
+ return res ? -1 : 0;
+}
+
int ast_indicate_data(struct ast_channel *chan, int _condition,
const void *data, size_t datalen)
{
@@ -4414,7 +4497,6 @@
/* who knows what we will get back! the anticipation is killing me. */
if (!(awesome_frame = ast_framehook_list_write_event(ast_channel_framehooks(chan), awesome_frame))
|| awesome_frame->frametype != AST_FRAME_CONTROL) {
-
res = 0;
goto indicate_cleanup;
}
@@ -4426,46 +4508,15 @@
switch (condition) {
case AST_CONTROL_CONNECTED_LINE:
- {
- struct ast_party_connected_line connected;
- unsigned char current[1024], proposed[1024];
- int current_size, proposed_size;
-
- ast_party_connected_line_set_init(&connected, ast_channel_connected(chan));
- res = ast_connected_line_parse_data(data, datalen, &connected);
- if (!res) {
- ast_channel_set_connected_line(chan, &connected, NULL);
- }
- ast_party_connected_line_free(&connected);
-
- current_size = ast_connected_line_build_data(current, sizeof(current),
- ast_channel_connected_indicated(chan), NULL);
- proposed_size = ast_connected_line_build_data(proposed, sizeof(proposed),
- ast_channel_connected(chan), NULL);
-
- if (current_size == -1 || proposed_size == -1) {
- goto indicate_cleanup;
- }
-
- if (!res && current_size == proposed_size &&
- !memcmp(current, proposed, current_size)) {
- goto indicate_cleanup;
- }
-
- ast_party_connected_line_copy(ast_channel_connected_indicated(chan),
- ast_channel_connected(chan));
+ if (indicate_connected_line(chan, data, datalen)) {
+ res = 0;
+ goto indicate_cleanup;
}
break;
case AST_CONTROL_REDIRECTING:
- {
- struct ast_party_redirecting redirecting;
-
- ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(chan));
- res = ast_redirecting_parse_data(data, datalen, &redirecting);
- if (!res) {
- ast_channel_set_redirecting(chan, &redirecting, NULL);
- }
- ast_party_redirecting_free(&redirecting);
+ if (indicate_redirecting(chan, data, datalen)) {
+ res = 0;
+ goto indicate_cleanup;
}
break;
case AST_CONTROL_HOLD:
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/core_local.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/core_local.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/core_local.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/core_local.c Mon Sep 16 09:52:24 2013
@@ -687,7 +687,7 @@
publish_local_bridge_message(p);
ast_answer(chan);
res = ast_bridge_impart(p->action.bridge.join, chan, p->action.bridge.swap,
- p->action.bridge.features, 1);
+ p->action.bridge.features, AST_BRIDGE_IMPART_CHAN_INDEPENDENT);
ao2_ref(p->action.bridge.join, -1);
p->action.bridge.join = NULL;
ao2_cleanup(p->action.bridge.swap);
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/core_unreal.c Mon Sep 16 09:52:24 2013
@@ -758,7 +758,8 @@
ast_set_flag(&features->feature_flags, flags);
/* Impart the semi2 channel into the bridge */
- if (ast_bridge_impart(bridge, chan, NULL, features, 1)) {
+ if (ast_bridge_impart(bridge, chan, NULL, features,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
ast_bridge_features_destroy(features);
ast_channel_unref(chan);
return -1;
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/features.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/features.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/features.c Mon Sep 16 09:52:24 2013
@@ -675,7 +675,8 @@
ast_bridge_basic_set_flags(bridge, flags);
/* Put peer into the bridge */
- if (ast_bridge_impart(bridge, peer, NULL, peer_features, 1)) {
+ if (ast_bridge_impart(bridge, peer, NULL, peer_features,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT | AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP)) {
ast_bridge_destroy(bridge, 0);
ast_bridge_features_cleanup(&chan_features);
bridge_failed_peer_goto(chan, peer);
@@ -683,7 +684,8 @@
}
/* Join bridge */
- ast_bridge_join(bridge, chan, NULL, &chan_features, NULL, 1);
+ ast_bridge_join(bridge, chan, NULL, &chan_features, NULL,
+ AST_BRIDGE_JOIN_PASS_REFERENCE | AST_BRIDGE_JOIN_INHIBIT_JOIN_COLP);
/*
* If the bridge was broken for a hangup that isn't real, then
@@ -1129,7 +1131,8 @@
goto done;
}
- ast_bridge_join(bridge, chan, NULL, &chan_features, NULL, 1);
+ ast_bridge_join(bridge, chan, NULL, &chan_features, NULL,
+ AST_BRIDGE_JOIN_PASS_REFERENCE);
ast_bridge_features_cleanup(&chan_features);
Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_applications.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_applications.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_applications.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_applications.c Mon Sep 16 09:52:24 2013
@@ -639,7 +639,8 @@
}
/* Now we should try to join the new bridge ourselves... */
- ast_bridge_join(retrieval_bridge, chan, NULL, &chan_features, NULL, 1);
+ ast_bridge_join(retrieval_bridge, chan, NULL, &chan_features, NULL,
+ AST_BRIDGE_JOIN_PASS_REFERENCE);
ast_bridge_features_cleanup(&chan_features);
Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_bridge_features.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_bridge_features.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_bridge_features.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_bridge_features.c Mon Sep 16 09:52:24 2013
@@ -316,7 +316,8 @@
return -1;
}
- if (ast_bridge_impart(bridge_channel->bridge, transfer_chan, NULL, NULL, 1)) {
+ if (ast_bridge_impart(bridge_channel->bridge, transfer_chan, NULL, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
ast_hangup(transfer_chan);
return -1;
}
Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_tests.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_tests.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_tests.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/parking/parking_tests.c Mon Sep 16 09:52:24 2013
@@ -82,6 +82,12 @@
ast_channel_release(chan);
}
+static void do_sleep(struct timespec *to_sleep)
+{
+ while ((nanosleep(to_sleep, to_sleep) == -1) && (errno == EINTR)) {
+ }
+}
+
static int fake_fixup(struct ast_channel *clonechan, struct ast_channel *original)
{
return 0;
@@ -99,7 +105,6 @@
struct parking_lot *test_lot;
test_cfg = parking_lot_cfg_create(name);
-
if (!test_cfg) {
return NULL;
}
@@ -120,7 +125,6 @@
}
test_lot = parking_lot_build_or_update(test_cfg, 1);
-
if (!test_lot) {
return NULL;
}
@@ -195,7 +199,6 @@
RAII_VAR(struct ast_channel *, chan_alice, NULL, safe_channel_release);
RAII_VAR(struct ast_bridge *, parking_bridge, NULL, ao2_cleanup);
- struct ast_bridge_features chan_features;
struct timespec to_sleep = {1, 0};
switch (cmd) {
@@ -219,7 +222,6 @@
}
chan_alice = create_alice_channel();
-
if (!chan_alice) {
ast_test_status_update(test, "Failed to create test channel to park. Test failed.\n");
dispose_test_lot(test_lot, 1);
@@ -227,27 +229,23 @@
}
ast_channel_state_set(chan_alice, AST_STATE_UP);
-
pbx_builtin_setvar_helper(chan_alice, "BLINDTRANSFER", ast_channel_name(chan_alice));
parking_bridge = park_application_setup(chan_alice, chan_alice, TEST_LOT_NAME, NULL);
-
if (!parking_bridge) {
ast_test_status_update(test, "Failed to get the parking bridge for '%s'. Test failed.\n", TEST_LOT_NAME);
dispose_test_lot(test_lot, 1);
return AST_TEST_FAIL;
}
- if (ast_bridge_features_init(&chan_features)) {
- ast_bridge_features_cleanup(&chan_features);
- ast_test_status_update(test, "Failed to initialize bridge features. Test failed.\n");
+ if (ast_bridge_impart(parking_bridge, chan_alice, NULL, NULL,
+ AST_BRIDGE_IMPART_CHAN_DEPARTABLE)) {
+ ast_test_status_update(test, "Failed to impart alice into parking lot. Test failed.\n");
dispose_test_lot(test_lot, 1);
return AST_TEST_FAIL;
}
- ast_bridge_impart(parking_bridge, chan_alice, NULL, NULL, 0);
-
- while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
+ do_sleep(&to_sleep);
ast_bridge_depart(chan_alice);
@@ -255,6 +253,7 @@
if (dispose_test_lot(test_lot, 1)) {
ast_test_status_update(test, "Found parking lot in container after attempted removal. Test failed.\n");
+ return AST_TEST_FAIL;
}
return AST_TEST_PASS;
@@ -352,8 +351,6 @@
.time_limit = 10,
.resolution = PARK_ANSWERED,
};
-
- struct ast_bridge_features chan_features;
switch (cmd) {
case TEST_INIT:
@@ -383,7 +380,6 @@
}
ast_channel_state_set(chan_alice, AST_STATE_UP);
-
pbx_builtin_setvar_helper(chan_alice, "BLINDTRANSFER", ast_channel_name(chan_alice));
parking_bridge = park_application_setup(chan_alice, chan_alice, TEST_LOT_NAME, NULL);
@@ -393,26 +389,23 @@
return AST_TEST_FAIL;
}
- if (ast_bridge_features_init(&chan_features)) {
- ast_bridge_features_cleanup(&chan_features);
- ast_test_status_update(test, "Failed to initialize bridge features. Test failed.\n");
+ if (ast_bridge_impart(parking_bridge, chan_alice, NULL, NULL,
+ AST_BRIDGE_IMPART_CHAN_DEPARTABLE)) {
+ ast_test_status_update(test, "Failed to impart alice into parking lot. Test failed.\n");
dispose_test_lot(test_lot, 1);
return AST_TEST_FAIL;
}
- ast_bridge_impart(parking_bridge, chan_alice, NULL, NULL, 0);
-
- while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
+ do_sleep(&to_sleep);
retrieved_user = parking_lot_retrieve_parked_user(test_lot, 701);
if (!retrieved_user) {
ast_test_status_update(test, "Failed to retrieve the parked user from the expected parking space. Test failed.\n");
-
failure = 1;
goto test_cleanup;
}
- ast_test_status_update(test, "Successfully retrieved parked user from the parking lot. Validating user data. Test failed.\n");
+ ast_test_status_update(test, "Successfully retrieved parked user from the parking lot. Validating user data.\n");
if (!parked_users_match(retrieved_user, &expected_user, test)) {
ast_test_status_update(test, "Parked user validation failed\n");
Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_refer.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_refer.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_refer.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/res_pjsip_refer.c Mon Sep 16 09:52:24 2013
@@ -768,7 +768,8 @@
response = 500;
}
} else {
- if (ast_bridge_impart(invite.bridge, session->channel, invite.channel, NULL, 1)) {
+ if (ast_bridge_impart(invite.bridge, session->channel, invite.channel, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
response = 500;
}
}
Modified: team/dlee/ASTERISK-22451-ari-subscribe/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/res/stasis/control.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/res/stasis/control.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/res/stasis/control.c Mon Sep 16 09:52:24 2013
@@ -117,7 +117,6 @@
command_fn = command_fn ? : noop_cb;
command = command_create(command_fn, data);
-
if (!command) {
return NULL;
}
@@ -166,7 +165,6 @@
ast_dial_set_global_timeout(dial, dial_data->timeout);
res = ast_dial_run(dial, NULL, 0);
-
if (res != AST_DIAL_RESULT_ANSWERED || !(new_chan = ast_dial_answered_steal(dial))) {
return NULL;
}
@@ -176,8 +174,12 @@
return NULL;
}
- ast_bridge_impart(bridge, new_chan, NULL, NULL, 1);
- stasis_app_control_add_channel_to_bridge(control, bridge);
+ if (ast_bridge_impart(bridge, new_chan, NULL, NULL,
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
+ ast_hangup(new_chan);
+ } else {
+ stasis_app_control_add_channel_to_bridge(control, bridge);
+ }
return NULL;
}
@@ -566,8 +568,7 @@
chan,
NULL, /* swap channel */
NULL, /* features */
- 0); /* independent - false allows us to ast_bridge_depart() */
-
+ AST_BRIDGE_IMPART_CHAN_DEPARTABLE);
if (res != 0) {
ast_log(LOG_ERROR, "Error adding channel to bridge\n");
ast_channel_pbx_set(chan, control->pbx);
Modified: team/dlee/ASTERISK-22451-ari-subscribe/tests/test_cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/tests/test_cdr.c?view=diff&rev=399156&r1=399155&r2=399156
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/tests/test_cdr.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/tests/test_cdr.c Mon Sep 16 09:52:24 2013
@@ -559,7 +559,7 @@
ast_test_validate(test, bridge != NULL);
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
- ast_bridge_impart(bridge, chan_alice, NULL, NULL, 0);
+ ast_test_validate(test, !ast_bridge_impart(bridge, chan_alice, NULL, NULL, AST_BRIDGE_IMPART_CHAN_DEPARTABLE));
chan_bob = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, "200", NULL, NULL, ast_channel_linkedid(chan_alice), 0, CHANNEL_TECH_NAME "/Bob");
ast_copy_string(bob_expected.linkedid, ast_channel_linkedid(chan_bob), sizeof(bob_expected.linkedid));
@@ -576,7 +576,7 @@
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
- ast_bridge_impart(bridge, chan_bob, NULL, NULL, 0);
+ ast_test_validate(test, !ast_bridge_impart(bridge, chan_bob, NULL, NULL, AST_BRIDGE_IMPART_CHAN_DEPARTABLE));
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
@@ -686,7 +686,7 @@
ast_test_validate(test, bridge != NULL);
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
- ast_bridge_impart(bridge, chan, NULL, NULL, 0);
+ ast_test_validate(test, !ast_bridge_impart(bridge, chan, NULL, NULL, AST_BRIDGE_IMPART_CHAN_DEPARTABLE));
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
@@ -761,7 +761,7 @@
ast_test_validate(test, bridge_one != NULL);
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
- ast_bridge_impart(bridge_one, chan, NULL, NULL, 0);
+ ast_test_validate(test, !ast_bridge_impart(bridge_one, chan, NULL, NULL, AST_BRIDGE_IMPART_CHAN_DEPARTABLE));
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
@@ -844,14 +844,14 @@
bridge = ast_bridge_basic_new();
ast_test_validate(test, bridge != NULL);
- ast_bridge_impart(bridge, chan_alice, NULL, NULL, 0);
+ ast_test_validate(test, !ast_bridge_impart(bridge, chan_alice, NULL, NULL, AST_BRIDGE_IMPART_CHAN_DEPARTABLE));
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
EMULATE_APP_DATA(chan_bob, 1, "Answer", "");
ast_setstate(chan_bob, AST_STATE_UP);
EMULATE_APP_DATA(chan_bob, 2, "Bridge", "");
- ast_bridge_impart(bridge, chan_bob, NULL, NULL, 0);
+ ast_test_validate(test, !ast_bridge_impart(bridge, chan_bob, NULL, NULL, AST_BRIDGE_IMPART_CHAN_DEPARTABLE));
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
ast_bridge_depart(chan_alice);
@@ -937,10 +937,10 @@
EMULATE_APP_DATA(chan_bob, 2, "Bridge", "");
while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
- ast_bridge_impart(bridge, chan_bob, NULL, NULL, 0);
- while ((nanosleep(&to_sleep, &to_sleep) == -1) && (errno == EINTR));
-
[... 135 lines stripped ...]
More information about the asterisk-commits
mailing list