[asterisk-commits] juggie: branch juggie/NoLossCDR r84150 - in /team/juggie/NoLossCDR: ./ channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Sep 30 23:10:35 CDT 2007


Author: juggie
Date: Sun Sep 30 23:10:35 2007
New Revision: 84150

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84150
Log:
Merged revisions 84027,84058,84088 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/group/CDRfix5

........
r84027 | root | 2007-09-27 20:09:15 -0400 (Thu, 27 Sep 2007) | 1 line

automerge commit
........
r84058 | root | 2007-09-28 02:09:26 -0400 (Fri, 28 Sep 2007) | 1 line

automerge commit
........
r84088 | root | 2007-09-28 11:09:06 -0400 (Fri, 28 Sep 2007) | 1 line

automerge commit
........

Modified:
    team/juggie/NoLossCDR/   (props changed)
    team/juggie/NoLossCDR/channels/chan_agent.c
    team/juggie/NoLossCDR/configure
    team/juggie/NoLossCDR/configure.ac
    team/juggie/NoLossCDR/include/asterisk/channel.h
    team/juggie/NoLossCDR/main/channel.c
    team/juggie/NoLossCDR/main/manager.c
    team/juggie/NoLossCDR/main/say.c

Propchange: team/juggie/NoLossCDR/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/juggie/NoLossCDR/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Sep 30 23:10:35 2007
@@ -1,1 +1,1 @@
-/team/group/CDRfix5:1-84013
+/team/group/CDRfix5:1-84149

Modified: team/juggie/NoLossCDR/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/channels/chan_agent.c?view=diff&rev=84150&r1=84149&r2=84150
==============================================================================
--- team/juggie/NoLossCDR/channels/chan_agent.c (original)
+++ team/juggie/NoLossCDR/channels/chan_agent.c Sun Sep 30 23:10:35 2007
@@ -231,6 +231,8 @@
 static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
 static void set_agentbycallerid(const char *callerid, const char *agent);
 static char *complete_agent_logoff_cmd(const char *line, const char *word, int pos, int state);
+static struct ast_channel* agent_get_base_channel(struct ast_channel *chan);
+static int agent_set_base_channel(struct ast_channel *chan, struct ast_channel *base);
 
 /*! \brief Channel interface description for PBX integration */
 static const struct ast_channel_tech agent_tech = {
@@ -253,6 +255,8 @@
 	.indicate = agent_indicate,
 	.fixup = agent_fixup,
 	.bridged_channel = agent_bridgedchannel,
+	.get_base_channel = agent_get_base_channel,
+	.set_base_channel = agent_set_base_channel,
 };
 
 /*!
@@ -696,6 +700,37 @@
 
 	snprintf(buf, sizeof(buf), "%s_%s", GETAGENTBYCALLERID, callerid);
 	pbx_builtin_setvar_helper(NULL, buf, agent);
+}
+
+struct ast_channel* agent_get_base_channel(struct ast_channel *chan)
+{
+	struct agent_pvt *p = NULL;
+	struct ast_channel *base = NULL;
+	
+	if (!chan || !chan->tech_pvt) {
+		ast_log(LOG_ERROR, "whoa, you need a channel (0x%ld) with a tech_pvt (0x%ld) to get a base channel.\n", (long)chan, (chan)?(long)chan->tech_pvt:(long)NULL);
+	} else {
+		p = chan->tech_pvt;
+		base = p->chan;
+	}
+	return base;
+}
+
+int agent_set_base_channel(struct ast_channel *chan, struct ast_channel *base)
+{
+	struct agent_pvt *p = NULL;
+	
+	if (!chan || !base) {
+		ast_log(LOG_ERROR, "whoa, you need a channel (0x%ld) and a base channel (0x%ld) for setting.\n", (long)chan, (long)base);
+		return -1;
+	}
+	p = chan->tech_pvt;
+	if (!p) {
+		ast_log(LOG_ERROR, "whoa, channel %s is missing his tech_pvt structure!!.\n", chan->name);
+		return -1;
+	}
+	p->chan = base;
+	return 0;
 }
 
 static int agent_hangup(struct ast_channel *ast)

Modified: team/juggie/NoLossCDR/configure
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/configure?view=diff&rev=84150&r1=84149&r2=84150
==============================================================================
--- team/juggie/NoLossCDR/configure (original)
+++ team/juggie/NoLossCDR/configure Sun Sep 30 23:10:35 2007
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 83431 .
+# From configure.ac Revision: 83517 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #

Modified: team/juggie/NoLossCDR/configure.ac
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/configure.ac?view=diff&rev=84150&r1=84149&r2=84150
==============================================================================
--- team/juggie/NoLossCDR/configure.ac (original)
+++ team/juggie/NoLossCDR/configure.ac Sun Sep 30 23:10:35 2007
@@ -6,7 +6,7 @@
 # this file just have to remember to set the AC_PREREQ argument
 # to something that suits their needs.
 
-AC_PREREQ(2.59)
+AC_PREREQ(2.60)
 
 m4_define([PBX_VERSION],
           m4_bpatsubst(m4_esyscmd([build_tools/make_version .]),

Modified: team/juggie/NoLossCDR/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/include/asterisk/channel.h?view=diff&rev=84150&r1=84149&r2=84150
==============================================================================
--- team/juggie/NoLossCDR/include/asterisk/channel.h (original)
+++ team/juggie/NoLossCDR/include/asterisk/channel.h Sun Sep 30 23:10:35 2007
@@ -314,6 +314,12 @@
 
 	/*! \brief Provide additional write items for CHANNEL() dialplan function */
 	int (* func_channel_write)(struct ast_channel *chan, const char *function, char *data, const char *value);
+
+	/*! \brief Retrieve base channel (agent and local) */
+	struct ast_channel* (* get_base_channel)(struct ast_channel *chan);
+	
+	/*! \brief Set base channel (agent and local) */
+	int (* set_base_channel)(struct ast_channel *chan, struct ast_channel *base);
 };
 
 struct ast_epoll_data;

Modified: team/juggie/NoLossCDR/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/main/channel.c?view=diff&rev=84150&r1=84149&r2=84150
==============================================================================
--- team/juggie/NoLossCDR/main/channel.c (original)
+++ team/juggie/NoLossCDR/main/channel.c Sun Sep 30 23:10:35 2007
@@ -3296,7 +3296,11 @@
 int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)
 {
 	int res = -1;
-	struct ast_channel *final_orig = original, *final_clone = clone;
+	struct ast_channel *final_orig, *final_clone;
+
+retrymasq:
+	final_orig = original;
+	final_clone = clone;
 
 	ast_channel_lock(original);
 	while (ast_channel_trylock(clone)) {
@@ -3314,11 +3318,19 @@
 		final_clone = clone->_bridge;
 
 	if ((final_orig != original) || (final_clone != clone)) {
-		ast_channel_lock(final_orig);
-		while (ast_channel_trylock(final_clone)) {
+		/* Lots and lots of deadlock avoidance.  The main one we're competing with
+		 * is ast_write(), which locks channels recursively, when working with a
+		 * proxy channel. */
+		if (ast_channel_trylock(final_orig)) {
+			ast_channel_unlock(clone);
+			ast_channel_unlock(original);
+			goto retrymasq;
+		}
+		if (ast_channel_trylock(final_clone)) {
 			ast_channel_unlock(final_orig);
-			usleep(1);
-			ast_channel_lock(final_orig);
+			ast_channel_unlock(clone);
+			ast_channel_unlock(original);
+			goto retrymasq;
 		}
 		ast_channel_unlock(clone);
 		ast_channel_unlock(original);

Modified: team/juggie/NoLossCDR/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/main/manager.c?view=diff&rev=84150&r1=84149&r2=84150
==============================================================================
--- team/juggie/NoLossCDR/main/manager.c (original)
+++ team/juggie/NoLossCDR/main/manager.c Sun Sep 30 23:10:35 2007
@@ -1787,7 +1787,7 @@
 	const char *exten = astman_get_header(m, "Exten");
 	const char *context = astman_get_header(m, "Context");
 	const char *priority = astman_get_header(m, "Priority");
-	struct ast_channel *chan, *chan2 = NULL;
+	struct ast_channel *base, *chan, *chan2 = NULL;
 	int pi = 0;
 	int res;
 
@@ -1809,6 +1809,14 @@
 		astman_send_error(s, m, buf);
 		return 0;
 	}
+	if (chan->tech->get_base_channel) {
+		base = chan->tech->get_base_channel(chan);
+		if (base) {
+			ast_mutex_unlock(&chan->lock);
+			chan = base;
+			ast_mutex_lock(&chan->lock);
+		}
+	}
 	if (ast_check_hangup(chan)) {
 		astman_send_error(s, m, "Redirect failed, channel not up.\n");
 		ast_channel_unlock(chan);
@@ -1821,6 +1829,14 @@
 		ast_channel_unlock(chan);
 		ast_channel_unlock(chan2);
 		return 0;
+	}
+	if (chan2 && chan2->tech->get_base_channel) {
+		base = chan2->tech->get_base_channel(chan2);
+		if (base) {
+			ast_mutex_unlock(&chan2->lock);
+			chan2 = base;
+			ast_mutex_lock(&chan2->lock);
+		}
 	}
 	res = ast_async_goto(chan, context, exten, pi);
 	if (!res) {

Modified: team/juggie/NoLossCDR/main/say.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/main/say.c?view=diff&rev=84150&r1=84149&r2=84150
==============================================================================
--- team/juggie/NoLossCDR/main/say.c (original)
+++ team/juggie/NoLossCDR/main/say.c Sun Sep 30 23:10:35 2007
@@ -1603,21 +1603,35 @@
 				snprintf(fn, sizeof(fn), "digits/%d", num - units);
 				num = 0;
 			}
+		} else if (num < 200) {
+			/* hundred, not one-hundred */
+			ast_copy_string(fn, "digits/hundred", sizeof(fn));
+			num -= ((num / 100) * 100);
+		} else if (num < 1000) {
+			snprintf(fn, sizeof(fn), "digits/%d", num / 100);
+			playh++;
+			num -= ((num / 100) * 100);
 		} else {
-			if (num < 1000) {
-				snprintf(fn, sizeof(fn), "digits/%d", (num/100));
-				playh++;
-				num -= ((num / 100) * 100);
+			if (num < 1100) {
+				/* thousand, not one-thousand */
+				num = num % 1000;
+				ast_copy_string(fn, "digits/thousand", sizeof(fn));
+			} else if (num < 10000)	{ /* 1,100 to 9,9999 */
+				res = ast_say_number_full_nl(chan, num / 100, ints, language, audiofd, ctrlfd);
+				if (res)
+					return res;
+				num = num % 100;
+				ast_copy_string(fn, "digits/hundred", sizeof(fn));
 			} else {
 				if (num < 1000000) { /* 1,000,000 */
-					res = ast_say_number_full_en(chan, num / 1000, ints, language, audiofd, ctrlfd);
+					res = ast_say_number_full_nl(chan, num / 1000, ints, language, audiofd, ctrlfd);
 					if (res)
 						return res;
 					num = num % 1000;
 					snprintf(fn, sizeof(fn), "digits/thousand");
 				} else {
 					if (num < 1000000000) { /* 1,000,000,000 */
-						res = ast_say_number_full_en(chan, num / 1000000, ints, language, audiofd, ctrlfd);
+						res = ast_say_number_full_nl(chan, num / 1000000, ints, language, audiofd, ctrlfd);
 						if (res)
 							return res;
 						num = num % 1000000;




More information about the asterisk-commits mailing list