[asterisk-commits] seanbright: branch 1.6.0 r155555 - in /branches/1.6.0: ./ apps/ include/aster...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 8 19:35:00 CST 2008


Author: seanbright
Date: Sat Nov  8 19:34:59 2008
New Revision: 155555

URL: http://svn.digium.com/view/asterisk?view=rev&rev=155555
Log:
Merged revisions 155554 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r155554 | seanbright | 2008-11-08 20:27:00 -0500 (Sat, 08 Nov 2008) | 14 lines

Merged revisions 155553 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r155553 | seanbright | 2008-11-08 20:08:07 -0500 (Sat, 08 Nov 2008) | 6 lines

Use static functions here instead of nested ones.  This requires a small
change to the ast_bridge_config struct as well.  To understand the reason
for this change, see the following post:

    http://gcc.gnu.org/ml/gcc-help/2008-11/msg00049.html

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_dial.c
    branches/1.6.0/apps/app_followme.c
    branches/1.6.0/apps/app_queue.c
    branches/1.6.0/include/asterisk/channel.h
    branches/1.6.0/main/features.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_dial.c?view=diff&rev=155555&r1=155554&r2=155555
==============================================================================
--- branches/1.6.0/apps/app_dial.c (original)
+++ branches/1.6.0/apps/app_dial.c Sat Nov  8 19:34:59 2008
@@ -1215,6 +1215,27 @@
 	ast_app_options2str64(dial_exec_options, &perm_opts, features->options, sizeof(features->options));
 }
 
+static void end_bridge_callback(void *data)
+{
+	char buf[80];
+	time_t end;
+	struct ast_channel *chan = data;
+
+	time(&end);
+
+	ast_channel_lock(chan);
+	if (chan->cdr->answer.tv_sec) {
+		snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->answer.tv_sec);
+		pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
+	}
+
+	if (chan->cdr->start.tv_sec) {
+		snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->start.tv_sec);
+		pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
+	}
+	ast_channel_unlock(chan);
+}
+
 static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags64 *peerflags, int *continue_exec)
 {
 	int res = -1; /* default: error */
@@ -1844,27 +1865,6 @@
 		if (res) { /* some error */
 			res = -1;
 		} else {
-			auto void end_bridge_callback(void);
-			void end_bridge_callback (void)
-			{
-				char buf[80];
-				time_t end;
-
-				time(&end);
-
-				ast_channel_lock(chan);
-				if (chan->cdr->answer.tv_sec) {
-					snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->answer.tv_sec);
-					pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
-				}
-
-				if (chan->cdr->start.tv_sec) {
-					snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->start.tv_sec);
-					pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
-				}
-				ast_channel_unlock(chan);
-			}
-
 			if (ast_test_flag64(peerflags, OPT_CALLEE_TRANSFER))
 				ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
 			if (ast_test_flag64(peerflags, OPT_CALLER_TRANSFER))
@@ -1889,6 +1889,7 @@
 				ast_set_flag(&(config.features_caller), AST_FEATURE_NO_H_EXTEN);
 
 			config.end_bridge_callback = end_bridge_callback;
+			config.end_bridge_callback_data = chan;
 
 			if (moh) {
 				moh = 0;

Modified: branches/1.6.0/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_followme.c?view=diff&rev=155555&r1=155554&r2=155555
==============================================================================
--- branches/1.6.0/apps/app_followme.c (original)
+++ branches/1.6.0/apps/app_followme.c Sat Nov  8 19:34:59 2008
@@ -875,6 +875,27 @@
 		
 }
 
+static void end_bridge_callback(void *data)
+{
+	char buf[80];
+	time_t end;
+	struct ast_channel *chan = data;
+
+	time(&end);
+
+	ast_channel_lock(chan);
+	if (chan->cdr->answer.tv_sec) {
+		snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->answer.tv_sec);
+		pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
+	}
+
+	if (chan->cdr->start.tv_sec) {
+		snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->start.tv_sec);
+		pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
+	}
+	ast_channel_unlock(chan);
+}
+
 static int app_exec(struct ast_channel *chan, void *data)
 {
 	struct fm_args targs;
@@ -986,27 +1007,6 @@
 			ast_stream_and_wait(chan, targs.sorryprompt, "");
 		res = 0;
 	} else {
-		auto void end_bridge_callback(void);
-		void end_bridge_callback (void)
-		{
-			char buf[80];
-			time_t end;
-
-			time(&end);
-
-			ast_channel_lock(chan);
-			if (chan->cdr->answer.tv_sec) {
-				snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->answer.tv_sec);
-				pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
-			}
-
-			if (chan->cdr->start.tv_sec) {
-				snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->start.tv_sec);
-				pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
-			}
-			ast_channel_unlock(chan);
-		}
-
 		caller = chan;
 		outbound = targs.outbound;
 		/* Bridge the two channels. */
@@ -1016,6 +1016,7 @@
 		ast_set_flag(&(config.features_callee), AST_FEATURE_AUTOMON);
 		ast_set_flag(&(config.features_caller), AST_FEATURE_AUTOMON);
 		config.end_bridge_callback = end_bridge_callback;
+		config.end_bridge_callback_data = chan;
 
 		ast_moh_stop(caller);
 		/* Be sure no generators are left on it */

Modified: branches/1.6.0/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_queue.c?view=diff&rev=155555&r1=155554&r2=155555
==============================================================================
--- branches/1.6.0/apps/app_queue.c (original)
+++ branches/1.6.0/apps/app_queue.c Sat Nov  8 19:34:59 2008
@@ -3144,6 +3144,15 @@
 	ast_channel_unlock(qe->chan);
 }
 
+static void end_bridge_callback(void *data)
+{
+	struct queue_ent *qe = data;
+
+	ao2_lock(qe->parent);
+	set_queue_variables(qe);
+	ao2_unlock(qe->parent);
+}
+
 /*! \brief A large function which calls members, updates statistics, and bridges the caller and a member
  * 
  * Here is the process of this function
@@ -3211,13 +3220,6 @@
 	int callcompletedinsl;
 	struct ao2_iterator memi;
 	struct ast_datastore *datastore;
-	auto void end_bridge_callback(void);
-	void end_bridge_callback(void)
-	{
-		ao2_lock(qe->parent);
-		set_queue_variables(qe);
-		ao2_unlock(qe->parent);
-	}
 
 	ast_channel_lock(qe->chan);
 	datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL);
@@ -3289,6 +3291,7 @@
 		}
 
 	bridge_config.end_bridge_callback = end_bridge_callback;
+	bridge_config.end_bridge_callback_data = qe;
 
 	/* Hold the lock while we setup the outgoing calls */
 	if (use_weight)

Modified: branches/1.6.0/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/channel.h?view=diff&rev=155555&r1=155554&r2=155555
==============================================================================
--- branches/1.6.0/include/asterisk/channel.h (original)
+++ branches/1.6.0/include/asterisk/channel.h Sat Nov  8 19:34:59 2008
@@ -620,7 +620,8 @@
 	const char *start_sound;
 	int firstpass;
 	unsigned int flags;
-	void (* end_bridge_callback)(void);   /*!< A callback that is called after a bridge attempt */
+	void (* end_bridge_callback)(void *);   /*!< A callback that is called after a bridge attempt */
+	void *end_bridge_callback_data;         /*!< Data passed to the callback */
 };
 
 struct chanmon;

Modified: branches/1.6.0/main/features.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/features.c?view=diff&rev=155555&r1=155554&r2=155555
==============================================================================
--- branches/1.6.0/main/features.c (original)
+++ branches/1.6.0/main/features.c Sat Nov  8 19:34:59 2008
@@ -2172,7 +2172,7 @@
 	new_peer_cdr = pick_unlocked_cdr(peer->cdr); /* the proper chan cdr, if there are forked cdrs */
 
 	if (res != AST_PBX_KEEPALIVE && config->end_bridge_callback) {
-		config->end_bridge_callback();
+		config->end_bridge_callback(config->end_bridge_callback_data);
 	}
 
 	autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);




More information about the asterisk-commits mailing list