[asterisk-commits] jrose: trunk r396245 - in /trunk: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 5 15:18:58 CDT 2013


Author: jrose
Date: Mon Aug  5 15:18:54 2013
New Revision: 396245

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396245
Log:
bridge features: Dial and Queue add features instead of replace them.

Dial and Queue would previously apply a new set of features whenever
bridging. These options would be based purely on the options supplied
to the dial/queue applications. This patch changes the function those
applications use to bridge calls so that the features will be added
to the set of existing features for each channel rather than having
them override the existing features.

(closes issue ASTERISK-22209)
Reported by: Jonathan Rose
Review: https://reviewboard.asterisk.org/r/2713/

Modified:
    trunk/include/asterisk/bridge_basic.h
    trunk/main/bridge_basic.c
    trunk/main/features.c

Modified: trunk/include/asterisk/bridge_basic.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/bridge_basic.h?view=diff&rev=396245&r1=396244&r2=396245
==============================================================================
--- trunk/include/asterisk/bridge_basic.h (original)
+++ trunk/include/asterisk/bridge_basic.h Mon Aug  5 15:18:54 2013
@@ -89,6 +89,22 @@
 int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags);
 
 /*!
+ * \brief Append basic bridge DTMF feature flags on the channel.
+ * \since 12.0.0
+ *
+ * \param chan Channel to append DTMF features datastore.
+ * \param flags Builtin DTMF feature flags. (ast_bridge_config flags)
+ *
+ * \note The channel must be locked before calling this function.
+ * \note This function differs from ast_bridge_features_ds_set only in that it won't
+ *       remove features already set on the channel.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int ast_bridge_features_ds_append(struct ast_channel *chan, struct ast_flags *flags);
+
+/*!
  * \brief Setup DTMF feature hooks using the channel features datastore property.
  * \since 12.0.0
  *

Modified: trunk/main/bridge_basic.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridge_basic.c?view=diff&rev=396245&r1=396244&r2=396245
==============================================================================
--- trunk/main/bridge_basic.c (original)
+++ trunk/main/bridge_basic.c Mon Aug  5 15:18:54 2013
@@ -220,7 +220,7 @@
 	return dtmf_features_flags_to_string(&held_copy, buffer, buf_size);
 }
 
-int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags)
+static int bridge_features_ds_set_full(struct ast_channel *chan, struct ast_flags *flags, int replace)
 {
 	struct ast_datastore *datastore;
 	struct ast_flags *ds_flags;
@@ -228,7 +228,12 @@
 	datastore = ast_channel_datastore_find(chan, &dtmf_features_info, NULL);
 	if (datastore) {
 		ds_flags = datastore->data;
-		*ds_flags = *flags;
+		if (replace) {
+			*ds_flags = *flags;
+		} else {
+			flags->flags = flags->flags | ds_flags->flags;
+			*ds_flags = *flags;
+		}
 		return 0;
 	}
 
@@ -247,6 +252,16 @@
 	datastore->data = ds_flags;
 	ast_channel_datastore_add(chan, datastore);
 	return 0;
+}
+
+int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags)
+{
+	return bridge_features_ds_set_full(chan, flags, 1);
+}
+
+int ast_bridge_features_ds_append(struct ast_channel *chan, struct ast_flags *flags)
+{
+	return bridge_features_ds_set_full(chan, flags, 0);
 }
 
 struct ast_flags *ast_bridge_features_ds_get(struct ast_channel *chan)

Modified: trunk/main/features.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features.c?view=diff&rev=396245&r1=396244&r2=396245
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Mon Aug  5 15:18:54 2013
@@ -953,10 +953,10 @@
 
 	res = 0;
 	ast_channel_lock(chan);
-	res |= ast_bridge_features_ds_set(chan, &config->features_caller);
+	res |= ast_bridge_features_ds_append(chan, &config->features_caller);
 	ast_channel_unlock(chan);
 	ast_channel_lock(peer);
-	res |= ast_bridge_features_ds_set(peer, &config->features_callee);
+	res |= ast_bridge_features_ds_append(peer, &config->features_callee);
 	ast_channel_unlock(peer);
 
 	if (res) {




More information about the asterisk-commits mailing list