[svn-commits] twilson: branch twilson/bug_11520-datastore_dial_features r105463 - in /team/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Feb 29 19:16:25 CST 2008


Author: twilson
Date: Fri Feb 29 19:16:24 2008
New Revision: 105463

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105463
Log:
Merged revisions 104592,104594-104595,104597,104617,104643,104687,104705,104756,104784,104788,104866,104869,104921,104974,105006,105060-105061,105144,105176,105210,105262-105263,105327,105378,105410-105411,105461 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r104592 | russell | 2008-02-27 10:46:49 -0600 (Wed, 27 Feb 2008) | 11 lines

Blocked revisions 104591 via svnmerge

........
r104591 | russell | 2008-02-27 10:45:00 -0600 (Wed, 27 Feb 2008) | 4 lines

When we receive a known alarm, make sure that the unknown alarm flag is not still
set to make sure that when we come back out of alarm, it gets reported in the log
and manager interface (after discussion with tzafrir on the -dev list)

........

................
r104594 | kpfleming | 2008-02-27 10:54:14 -0600 (Wed, 27 Feb 2008) | 16 lines

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

........
r104593 | kpfleming | 2008-02-27 10:53:06 -0600 (Wed, 27 Feb 2008) | 8 lines

fallback to standard English prompts properly when using new prompt directory layout

(closes issue #11831)
Reported by: IgorG
Patches:
      fallbacken.v1.diff uploaded by IgorG (license 20) (modified by me to improve code and conform rest of function to coding guidelines)


........

................
r104595 | file | 2008-02-27 11:04:16 -0600 (Wed, 27 Feb 2008) | 2 lines

After further discussion revert my previous commit for this. Currently in order to ensure devicestate is the expected value in another module (such as app_queue) then chan_sip must be loaded before hand.

................
r104597 | file | 2008-02-27 11:12:08 -0600 (Wed, 27 Feb 2008) | 12 lines

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

........
r104596 | file | 2008-02-27 13:07:33 -0400 (Wed, 27 Feb 2008) | 4 lines

Use the lock (which already existed, it just wasn't used) on the updaters list to protect the contents instead of the overall module list lock.
(closes issue #12080)
Reported by: ChaseVenters

........

................
r104617 | qwell | 2008-02-27 11:31:31 -0600 (Wed, 27 Feb 2008) | 16 lines

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

........
r104598 | qwell | 2008-02-27 11:26:55 -0600 (Wed, 27 Feb 2008) | 8 lines

Inherit language from the transfering channel on a blind transfer.

(closes issue #11682)
Reported by: caio1982
Patches:
      local_atxfer_lang3-1.4.diff uploaded by caio1982 (license 22)
Tested by: caio1982, victoryure

........

................
r104643 | russell | 2008-02-27 11:36:50 -0600 (Wed, 27 Feb 2008) | 12 lines

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

........
r104625 | russell | 2008-02-27 11:33:04 -0600 (Wed, 27 Feb 2008) | 4 lines

Fix a problem in ChanSpy where it could get stuck in an infinite loop without
being able to detect that the calling channel hung up.
(closes issue #12076, reported by junky, patched by me)

........

................
r104687 | file | 2008-02-27 11:45:55 -0600 (Wed, 27 Feb 2008) | 10 lines

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

........
r104665 | file | 2008-02-27 13:41:40 -0400 (Wed, 27 Feb 2008) | 2 lines

Bump up the buffer by 2.

........

................
r104705 | tilghman | 2008-02-27 12:20:35 -0600 (Wed, 27 Feb 2008) | 10 lines

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

........
r104704 | tilghman | 2008-02-27 12:15:10 -0600 (Wed, 27 Feb 2008) | 2 lines

Ensure the session ID can't be 0.

........

................
r104756 | qwell | 2008-02-27 13:36:34 -0600 (Wed, 27 Feb 2008) | 1 line

Remove useless 's' and 'key' variables, in favor of 'val', which serves the exact same purpose.
................
r104784 | mmichelson | 2008-02-27 14:37:32 -0600 (Wed, 27 Feb 2008) | 12 lines

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

........
r104783 | mmichelson | 2008-02-27 14:36:26 -0600 (Wed, 27 Feb 2008) | 4 lines

Bump a couple of more buffers up by 2 so that annoying warnings aren't generated
like crazy on every fileexists_core call.


........

................
r104788 | file | 2008-02-27 15:02:08 -0600 (Wed, 27 Feb 2008) | 10 lines

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

........
r104787 | file | 2008-02-27 16:56:23 -0400 (Wed, 27 Feb 2008) | 2 lines

Don't loop around infinitely trying to spy on our own channel, and don't forget to free/detach the datastore upon hangup of the spy.

........

................
r104866 | russell | 2008-02-27 17:58:49 -0600 (Wed, 27 Feb 2008) | 6 lines

reduce indentation in alloc_sub
(issue #12079)
Reported by: tzafrir
Patches:
      alloc_sub uploaded by tzafrir (license 46)

................
r104869 | tilghman | 2008-02-27 18:11:31 -0600 (Wed, 27 Feb 2008) | 15 lines

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

........
r104868 | tilghman | 2008-02-27 18:05:06 -0600 (Wed, 27 Feb 2008) | 7 lines

Compatibility fix for PPC64
(closes issue #12081)
 Reported by: jcollie
 Patches: 
       asterisk-1.4.18-funcdesc.patch uploaded by jcollie (license 412)
 Tested by: jcollie, Corydon76

........

................
r104921 | qwell | 2008-02-27 22:37:28 -0600 (Wed, 27 Feb 2008) | 10 lines

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

........
r104920 | qwell | 2008-02-27 22:31:21 -0600 (Wed, 27 Feb 2008) | 2 lines

According to a video at www.cisco.com, the 7921G supports 6 line appearances.

........

................
r104974 | tilghman | 2008-02-28 08:42:32 -0600 (Thu, 28 Feb 2008) | 6 lines

Fix crash when configuration does not match hardware detection.
(closes issue #12096)
 Reported by: mmickan
 Patches: 
       chan_vpb.cc.diff uploaded by mmickan (license 400)

................
r105006 | qwell | 2008-02-28 13:21:15 -0600 (Thu, 28 Feb 2008) | 17 lines

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

........
r105005 | qwell | 2008-02-28 13:20:10 -0600 (Thu, 28 Feb 2008) | 9 lines

Make pbx_exec pass an empty string into applications, if we get NULL.
This protects against possible segfaults in applications that may try
 to use data before checking length (ast_strdupa'ing it, for example)

(closes issue #12100)
Reported by: foxfire
Patches:
      12100-nullappargs.diff uploaded by qwell (license 4)

........

................
r105060 | mmichelson | 2008-02-28 14:14:04 -0600 (Thu, 28 Feb 2008) | 25 lines

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

........
r104841 | mmichelson | 2008-02-27 15:49:20 -0600 (Wed, 27 Feb 2008) | 17 lines

Two fixes:

1. Make the list of ast_dial_channels a lockable list. This is because in some cases,
   the ast_dial may exist in multiple threads due to asynchronous execution of its application, and
   I found some cases where race conditions could exist.

2. Check in ast_dial_join to be sure that the channel still exists before attempting to lock it, since
   it could have gotten hung up but the is_running_app flag on the ast_dial_channel may not have been
   cleared yet.

(closes issue #12038)
Reported by: jvandal
Patches:
      12038v2.patch uploaded by putnopvut (license 60)
Tested by: jvandal


........

................
r105061 | mmichelson | 2008-02-28 14:14:38 -0600 (Thu, 28 Feb 2008) | 14 lines

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

........
r105059 | mmichelson | 2008-02-28 14:11:57 -0600 (Thu, 28 Feb 2008) | 6 lines

When using autofill, members who are in use should be counted towards the 
number of available members to call if ringinuse is set to yes.

Thanks to jmls who brought this issue up on IRC


........

................
r105144 | russell | 2008-02-28 16:39:26 -0600 (Thu, 28 Feb 2008) | 16 lines

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

........
r105116 | russell | 2008-02-28 16:23:05 -0600 (Thu, 28 Feb 2008) | 8 lines

Fix a bug in the lock tracking code that was discovered by mmichelson.  The issue
is that if the lock history array was full, then the functions to mark a lock as
acquired or not would adjust the stats for whatever lock is at the end of the array,
which may not be itself.  So, do a sanity check to make sure that we're updating
lock info for the proper lock.

(This explains the bizarre stats on lock #63 in BE-396, thanks Mark!)

........

................
r105176 | tilghman | 2008-02-28 19:15:20 -0600 (Thu, 28 Feb 2008) | 15 lines

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

........
r105113 | tilghman | 2008-02-28 15:56:54 -0600 (Thu, 28 Feb 2008) | 7 lines

Update init script for LSB compat
(closes issue #9843)
 Reported by: ibc
 Patches: 
       rc.debian.asterisk.patch uploaded by ibc (license 211)
 Tested by: paravoid

........

................
r105210 | phsultan | 2008-02-29 07:12:34 -0600 (Fri, 29 Feb 2008) | 9 lines

Automatically create new buddy upon reception of a presence stanza of
type subscribed.

(closes issue #12066)
Reported by: ffadaie
Patches:
      branch-1.4-12066-1.diff uploaded by phsultan (license 73)
      trunk-12066-1.diff uploaded by phsultan (license 73)
Tested by: ffadaie, phsultan
................
r105262 | file | 2008-02-29 07:55:22 -0600 (Fri, 29 Feb 2008) | 12 lines

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

........
r105261 | file | 2008-02-29 09:48:13 -0400 (Fri, 29 Feb 2008) | 4 lines

Bump up the size of the uniqueid variable.
(closes issue #12107)
Reported by: asgaroth

........

................
r105263 | phsultan | 2008-02-29 08:15:03 -0600 (Fri, 29 Feb 2008) | 3 lines

Remove unnecessary if statements before calling iks_delete (redundant check is
done inside iks_delete), thus making the code conform with coding guidelines.

................
r105327 | phsultan | 2008-02-29 08:50:40 -0600 (Fri, 29 Feb 2008) | 9 lines

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

........
r105326 | phsultan | 2008-02-29 15:47:10 +0100 (Fri, 29 Feb 2008) | 1 line

Fix a potential memory leak
........

................
r105378 | file | 2008-02-29 12:34:46 -0600 (Fri, 29 Feb 2008) | 6 lines

Add documentation for setting username/password in SIP dial string.
(closes issue #11587)
Reported by: sobomax
Patches:
      dialstring_doc.diff uploaded by sobomax (license 359)

................
r105410 | russell | 2008-02-29 17:36:46 -0600 (Fri, 29 Feb 2008) | 31 lines

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

........
r105409 | russell | 2008-02-29 17:34:32 -0600 (Fri, 29 Feb 2008) | 23 lines

Fix a major bug in autoservice.  There was a race condition in the handling of
the list of channels in autoservice.  The problem was that it was possible for
a channel to get removed from autoservice and destroyed, while the autoservice
thread was still messing with the channel.  This led to memory corruption, and
caused crashes.  This explains multiple backtraces I have seen that have
references to autoservice, but do to the nature of the issue (memory corruption),
could cause crashes in a number of areas.

(fixes the crash in BE-386)
(closes issue #11694)
(closes issue #11940)

The following issues could be related.  If you are the reporter of one of these,
please update to include this fix and try again.

(potentially fixes issue #11189)
(potentially fixes issue #12107)
(potentially fixes issue #11573)
(potentially fixes issue #12008)
(potentially fixes issue #11189)
(potentially fixes issue #11993)
(potentially fixes issue #11791)

........

................
r105411 | tilghman | 2008-02-29 17:53:42 -0600 (Fri, 29 Feb 2008) | 2 lines

Convert to use ast_str

................
r105461 | russell | 2008-02-29 18:53:25 -0600 (Fri, 29 Feb 2008) | 9 lines

Add a "devstate change" CLI command to control custom device states.  Also,
do some additional code cleanup and improvement in passing.

(closes issue #12106)
Reported by: nizon
Patches:
      devstate-patch.txt uploaded by nizon (license 415)
        -- Updated to trunk, and tab completion added by me

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

Modified:
    team/twilson/bug_11520-datastore_dial_features/   (props changed)
    team/twilson/bug_11520-datastore_dial_features/CHANGES
    team/twilson/bug_11520-datastore_dial_features/apps/app_chanspy.c
    team/twilson/bug_11520-datastore_dial_features/apps/app_queue.c
    team/twilson/bug_11520-datastore_dial_features/apps/app_voicemail.c
    team/twilson/bug_11520-datastore_dial_features/build_tools/strip_nonapi
    team/twilson/bug_11520-datastore_dial_features/cdr/cdr_adaptive_odbc.c
    team/twilson/bug_11520-datastore_dial_features/channels/chan_gtalk.c
    team/twilson/bug_11520-datastore_dial_features/channels/chan_jingle.c
    team/twilson/bug_11520-datastore_dial_features/channels/chan_sip.c
    team/twilson/bug_11520-datastore_dial_features/channels/chan_skinny.c
    team/twilson/bug_11520-datastore_dial_features/channels/chan_vpb.cc
    team/twilson/bug_11520-datastore_dial_features/channels/chan_zap.c
    team/twilson/bug_11520-datastore_dial_features/configs/sip.conf.sample
    team/twilson/bug_11520-datastore_dial_features/contrib/init.d/rc.debian.asterisk
    team/twilson/bug_11520-datastore_dial_features/funcs/func_devstate.c
    team/twilson/bug_11520-datastore_dial_features/include/asterisk/lock.h
    team/twilson/bug_11520-datastore_dial_features/main/Makefile
    team/twilson/bug_11520-datastore_dial_features/main/autoservice.c
    team/twilson/bug_11520-datastore_dial_features/main/cdr.c
    team/twilson/bug_11520-datastore_dial_features/main/dial.c
    team/twilson/bug_11520-datastore_dial_features/main/features.c
    team/twilson/bug_11520-datastore_dial_features/main/file.c
    team/twilson/bug_11520-datastore_dial_features/main/loader.c
    team/twilson/bug_11520-datastore_dial_features/main/manager.c
    team/twilson/bug_11520-datastore_dial_features/main/pbx.c
    team/twilson/bug_11520-datastore_dial_features/main/utils.c
    team/twilson/bug_11520-datastore_dial_features/res/res_jabber.c
    team/twilson/bug_11520-datastore_dial_features/utils/check_expr.c

Propchange: team/twilson/bug_11520-datastore_dial_features/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/twilson/bug_11520-datastore_dial_features/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/twilson/bug_11520-datastore_dial_features/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Feb 29 19:16:24 2008
@@ -1,1 +1,1 @@
-/trunk:1-104587
+/trunk:1-105462

Modified: team/twilson/bug_11520-datastore_dial_features/CHANGES
URL: http://svn.digium.com/view/asterisk/team/twilson/bug_11520-datastore_dial_features/CHANGES?view=diff&rev=105463&r1=105462&r2=105463
==============================================================================
--- team/twilson/bug_11520-datastore_dial_features/CHANGES (original)
+++ team/twilson/bug_11520-datastore_dial_features/CHANGES Fri Feb 29 19:16:24 2008
@@ -97,6 +97,9 @@
   * New CLI command: "core set chanvar" to set a channel variable from the CLI.
   * Added an easy way to execute Asterisk CLI commands at startup.  Any commands
     listed in the startup_commands section of cli.conf will get executed.
+  * Added a CLI command, "devstate change", which allows you to set custom device
+     states from the func_devstate module that provides the DEVICE_STATE() function
+     and handling of the "Custom:" devices.
 
 SIP changes
 -----------
@@ -166,7 +169,7 @@
   * Proper codec support in chan_skinny.
   * Added settings for IP and Ethernet QoS requests
 
-MGCP changes
+
 ------------
   * Added separate settings for media QoS in mgcp.conf
 

Modified: team/twilson/bug_11520-datastore_dial_features/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/twilson/bug_11520-datastore_dial_features/apps/app_chanspy.c?view=diff&rev=105463&r1=105462&r2=105463
==============================================================================
--- team/twilson/bug_11520-datastore_dial_features/apps/app_chanspy.c (original)
+++ team/twilson/bug_11520-datastore_dial_features/apps/app_chanspy.c Fri Feb 29 19:16:24 2008
@@ -500,6 +500,10 @@
 	if (!strncmp(this->name, "Zap/pseudo", 10)) {
 		ast_channel_unlock(this);
 		goto redo;
+	} else if (this == chan) {
+		last = this;
+		ast_channel_unlock(this);
+		goto redo;
 	}
 
 	return setup_chanspy_ds(this, chanspy_ds);
@@ -610,9 +614,10 @@
 				break;
 			}
 
-			if (peer == chan) {
+			if (ast_check_hangup(chan)) {
 				ast_channel_unlock(peer);
-				continue;
+				chanspy_ds_free(peer_chanspy_ds);
+				break;
 			}
 
 			if (ast_test_flag(flags, OPTION_BRIDGED) && !ast_bridged_channel(peer)) {
@@ -708,6 +713,7 @@
 			num_spyed_upon++;	
 
 			if (res == -1) {
+				chanspy_ds_free(peer_chanspy_ds);
 				goto exit;
 			} else if (res == -2) {
 				res = 0;
@@ -738,6 +744,8 @@
 				peer = NULL;
 			}
 		}
+		if (res == -1 || ast_check_hangup(chan))
+			break;
 	}
 exit:
 

Modified: team/twilson/bug_11520-datastore_dial_features/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/twilson/bug_11520-datastore_dial_features/apps/app_queue.c?view=diff&rev=105463&r1=105462&r2=105463
==============================================================================
--- team/twilson/bug_11520-datastore_dial_features/apps/app_queue.c (original)
+++ team/twilson/bug_11520-datastore_dial_features/apps/app_queue.c Fri Feb 29 19:16:24 2008
@@ -2687,6 +2687,10 @@
 			struct ao2_iterator mem_iter = ao2_iterator_init(qe->parent->members, 0);
 			while ((cur = ao2_iterator_next(&mem_iter))) {
 				switch (cur->status) {
+				case AST_DEVICE_INUSE:
+					if (!qe->parent->ringinuse)
+						break;
+					/* else fall through */
 				case AST_DEVICE_NOT_INUSE:
 				case AST_DEVICE_UNKNOWN:
 					if (!cur->paused)

Modified: team/twilson/bug_11520-datastore_dial_features/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/twilson/bug_11520-datastore_dial_features/apps/app_voicemail.c?view=diff&rev=105463&r1=105462&r2=105463
==============================================================================
--- team/twilson/bug_11520-datastore_dial_features/apps/app_voicemail.c (original)
+++ team/twilson/bug_11520-datastore_dial_features/apps/app_voicemail.c Fri Feb 29 19:16:24 2008
@@ -375,7 +375,7 @@
 	char zonetag[80];                /*!< Time zone */
 	char callback[80];
 	char dialout[80];
-	char uniqueid[20];               /*!< Unique integer identifier */
+	char uniqueid[80];               /*!< Unique integer identifier */
 	char exit[80];
 	char attachfmt[20];              /*!< Attachment format */
 	unsigned int flags;              /*!< VM_ flags */	
@@ -8174,8 +8174,6 @@
 	char *cat;
 	struct ast_variable *var;
 	const char *val;
-	const char *s;
-	const char *key;
 	char *q, *stringp;
 	int x;
 	int tmpadsi[4];
@@ -8387,7 +8385,7 @@
 		}
 
 		/* SMDI voicemail notification */
-		if ((s = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(s)) {
+		if ((val = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(val)) {
 			ast_debug(1, "Enabled SMDI voicemail notification\n");
 			if ((val = ast_variable_retrieve(cfg, "general", "smdiport"))) {
 				smdi_iface = ast_smdi_interface_find(val);
@@ -8410,19 +8408,19 @@
 		ast_copy_string(serveremail, val, sizeof(serveremail));
 		
 		vmmaxsecs = 0;
-		if ((s = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				vmmaxsecs = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max message time length\n");
 			}
-		} else if ((s = ast_variable_retrieve(cfg, "general", "maxmessage"))) {
+		} else if ((val = ast_variable_retrieve(cfg, "general", "maxmessage"))) {
 			static int maxmessage_deprecate = 0;
 			if (maxmessage_deprecate == 0) {
 				maxmessage_deprecate = 1;
 				ast_log(LOG_WARNING, "Setting 'maxmessage' has been deprecated in favor of 'maxsecs'.\n");
 			}
-			if (sscanf(s, "%d", &x) == 1) {
+			if (sscanf(val, "%d", &x) == 1) {
 				vmmaxsecs = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max message time length\n");
@@ -8430,21 +8428,21 @@
 		}
 
 		vmminsecs = 0;
-		if ((s = ast_variable_retrieve(cfg, "general", "minsecs"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "minsecs"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				vmminsecs = x;
 				if (maxsilence <= vmminsecs)
 					ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
 			} else {
 				ast_log(LOG_WARNING, "Invalid min message time length\n");
 			}
-		} else if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) {
+		} else if ((val = ast_variable_retrieve(cfg, "general", "minmessage"))) {
 			static int maxmessage_deprecate = 0;
 			if (maxmessage_deprecate == 0) {
 				maxmessage_deprecate = 1;
 				ast_log(LOG_WARNING, "Setting 'minmessage' has been deprecated in favor of 'minsecs'.\n");
 			}
-			if (sscanf(s, "%d", &x) == 1) {
+			if (sscanf(val, "%d", &x) == 1) {
 				vmminsecs = x;
 				if (maxsilence <= vmminsecs)
 					ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
@@ -8459,16 +8457,16 @@
 		ast_copy_string(vmfmts, val, sizeof(vmfmts));
 
 		skipms = 3000;
-		if ((s = ast_variable_retrieve(cfg, "general", "maxgreet"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "maxgreet"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				maxgreet = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max message greeting length\n");
 			}
 		}
 
-		if ((s = ast_variable_retrieve(cfg, "general", "skipms"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "skipms"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				skipms = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid skipms value\n");
@@ -8476,8 +8474,8 @@
 		}
 
 		maxlogins = 3;
-		if ((s = ast_variable_retrieve(cfg, "general", "maxlogins"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "maxlogins"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				maxlogins = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max failed login attempts\n");
@@ -8494,9 +8492,9 @@
 			val = "no";
 		ast_set2_flag((&globalflags), ast_true(val), VM_FORCEGREET);
 
-		if ((s = ast_variable_retrieve(cfg, "general", "cidinternalcontexts"))) {
-			ast_debug(1, "VM_CID Internal context string: %s\n", s);
-			stringp = ast_strdupa(s);
+		if ((val = ast_variable_retrieve(cfg, "general", "cidinternalcontexts"))) {
+			ast_debug(1, "VM_CID Internal context string: %s\n", val);
+			stringp = ast_strdupa(val);
 			for (x = 0; x < MAX_NUM_CID_CONTEXTS; x++) {
 				if (!ast_strlen_zero(stringp)) {
 					q = strsep(&stringp, ",");
@@ -8608,16 +8606,16 @@
 		if ((val = ast_variable_retrieve(cfg, "general", "vm-mismatch")))
 			ast_copy_string(vm_mismatch, val, sizeof(vm_mismatch));
 		/* load configurable audio prompts */
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-forward-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_forward_key, key, sizeof(listen_control_forward_key));
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-reverse-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_reverse_key, key, sizeof(listen_control_reverse_key));
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-pause-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_pause_key, key, sizeof(listen_control_pause_key));
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-restart-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_restart_key, key, sizeof(listen_control_restart_key));
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-stop-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_stop_key, key, sizeof(listen_control_stop_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-forward-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_forward_key, val, sizeof(listen_control_forward_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-reverse-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_reverse_key, val, sizeof(listen_control_reverse_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-pause-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_pause_key, val, sizeof(listen_control_pause_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-restart-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_restart_key, val, sizeof(listen_control_restart_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-stop-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_stop_key, val, sizeof(listen_control_stop_key));
 
 		if (!(val = ast_variable_retrieve(cfg, "general", "usedirectory"))) 
 			val = "no";
@@ -8707,39 +8705,39 @@
 			ast_free(pagersubject);
 			pagersubject = NULL;
 		}
-		if ((s = ast_variable_retrieve(cfg, "general", "pbxskip")))
-			ast_set2_flag((&globalflags), ast_true(s), VM_PBXSKIP);
-		if ((s = ast_variable_retrieve(cfg, "general", "fromstring")))
-			ast_copy_string(fromstring, s, sizeof(fromstring));
-		if ((s = ast_variable_retrieve(cfg, "general", "pagerfromstring")))
-			ast_copy_string(pagerfromstring, s, sizeof(pagerfromstring));
-		if ((s = ast_variable_retrieve(cfg, "general", "charset")))
-			ast_copy_string(charset, s, sizeof(charset));
-		if ((s = ast_variable_retrieve(cfg, "general", "adsifdn"))) {
-			sscanf(s, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
+		if ((val = ast_variable_retrieve(cfg, "general", "pbxskip")))
+			ast_set2_flag((&globalflags), ast_true(val), VM_PBXSKIP);
+		if ((val = ast_variable_retrieve(cfg, "general", "fromstring")))
+			ast_copy_string(fromstring, val, sizeof(fromstring));
+		if ((val = ast_variable_retrieve(cfg, "general", "pagerfromstring")))
+			ast_copy_string(pagerfromstring, val, sizeof(pagerfromstring));
+		if ((val = ast_variable_retrieve(cfg, "general", "charset")))
+			ast_copy_string(charset, val, sizeof(charset));
+		if ((val = ast_variable_retrieve(cfg, "general", "adsifdn"))) {
+			sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
 			for (x = 0; x < 4; x++) {
 				memcpy(&adsifdn[x], &tmpadsi[x], 1);
 			}
 		}
-		if ((s = ast_variable_retrieve(cfg, "general", "adsisec"))) {
-			sscanf(s, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
+		if ((val = ast_variable_retrieve(cfg, "general", "adsisec"))) {
+			sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
 			for (x = 0; x < 4; x++) {
 				memcpy(&adsisec[x], &tmpadsi[x], 1);
 			}
 		}
-		if ((s = ast_variable_retrieve(cfg, "general", "adsiver")))
-			if (atoi(s)) {
-				adsiver = atoi(s);
-			}
-		if ((s = ast_variable_retrieve(cfg, "general", "emailtitle"))) {
+		if ((val = ast_variable_retrieve(cfg, "general", "adsiver")))
+			if (atoi(val)) {
+				adsiver = atoi(val);
+			}
+		if ((val = ast_variable_retrieve(cfg, "general", "emailtitle"))) {
 			ast_log(LOG_NOTICE, "Keyword 'emailtitle' is DEPRECATED, please use 'emailsubject' instead.\n");
-			ast_copy_string(emailtitle, s, sizeof(emailtitle));
-		}
-		if ((s = ast_variable_retrieve(cfg, "general", "emailsubject")))
-			emailsubject = ast_strdup(s);
-		if ((s = ast_variable_retrieve(cfg, "general", "emailbody"))) {
+			ast_copy_string(emailtitle, val, sizeof(emailtitle));
+		}
+		if ((val = ast_variable_retrieve(cfg, "general", "emailsubject")))
+			emailsubject = ast_strdup(val);
+		if ((val = ast_variable_retrieve(cfg, "general", "emailbody"))) {
 			char *tmpread, *tmpwrite;
-			emailbody = ast_strdup(s);
+			emailbody = ast_strdup(val);
 
 			/* substitute strings \t and \n into the appropriate characters */
 			tmpread = tmpwrite = emailbody;
@@ -8763,11 +8761,11 @@
 				tmpread = tmpwrite + 1;
 			}
 		}
-		if ((s = ast_variable_retrieve(cfg, "general", "pagersubject")))
-			pagersubject = ast_strdup(s);
-		if ((s = ast_variable_retrieve(cfg, "general", "pagerbody"))) {
+		if ((val = ast_variable_retrieve(cfg, "general", "pagersubject")))
+			pagersubject = ast_strdup(val);
+		if ((val = ast_variable_retrieve(cfg, "general", "pagerbody"))) {
 			char *tmpread, *tmpwrite;
-			pagerbody = ast_strdup(s);
+			pagerbody = ast_strdup(val);
 
 			/* substitute strings \t and \n into the appropriate characters */
 			tmpread = tmpwrite = pagerbody;

Modified: team/twilson/bug_11520-datastore_dial_features/build_tools/strip_nonapi
URL: http://svn.digium.com/view/asterisk/team/twilson/bug_11520-datastore_dial_features/build_tools/strip_nonapi?view=diff&rev=105463&r1=105462&r2=105463
==============================================================================
--- team/twilson/bug_11520-datastore_dial_features/build_tools/strip_nonapi (original)
+++ team/twilson/bug_11520-datastore_dial_features/build_tools/strip_nonapi Fri Feb 29 19:16:24 2008
@@ -18,9 +18,18 @@
 
 FILTER="${GREP} -v -e ^ast_ -e ^_ast_ -e ^__ast_ -e ^astman_ -e ^pbx_ -e ^resample_"
 
+case "${PROC}" in
+	powerpc64)
+		TEXTSYM=" D "
+		;;
+	*)
+		TEXTSYM=" T "
+		;;
+esac
+
 case "${OSARCH}" in
     linux-gnu|FreeBSD)
-	nm ${1} | ${GREP} -e " T " | cut -d" " -f3 | ${FILTER} > striplist
+	nm ${1} | ${GREP} -e "$TEXTSYM" | cut -d" " -f3 | ${FILTER} > striplist
 	sed -e "s/^/-N /" striplist | xargs ${STRIP} ${1}
 	rm -f striplist
 	;;

Modified: team/twilson/bug_11520-datastore_dial_features/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/team/twilson/bug_11520-datastore_dial_features/cdr/cdr_adaptive_odbc.c?view=diff&rev=105463&r1=105462&r2=105463
==============================================================================
--- team/twilson/bug_11520-datastore_dial_features/cdr/cdr_adaptive_odbc.c (original)
+++ team/twilson/bug_11520-datastore_dial_features/cdr/cdr_adaptive_odbc.c Fri Feb 29 19:16:24 2008
@@ -293,11 +293,8 @@
 #define LENGTHEN_BUF1(size)														\
 			do {																\
 				/* Lengthen buffer, if necessary */								\
-				if ((newsize = lensql + (size) + 3) > sizesql) {	\
-					if ((tmp = ast_realloc(sql, (newsize / 512 + 1) * 512))) {	\
-						sql = tmp;												\
-						sizesql = (newsize / 512 + 1) * 512;					\
-					} else {													\
+				if (sql->used + size + 1 > sql->len) {                          \
+					if (ast_str_make_space(&sql, ((sql->len + size + 1) / 512 + 1) * 512) != 0) { \
 						ast_log(LOG_ERROR, "Unable to allocate sufficient memory.  Insert CDR '%s:%s' failed.\n", tableptr->connection, tableptr->table); \
 						ast_free(sql);											\
 						ast_free(sql2);											\
@@ -309,12 +306,9 @@
 
 #define LENGTHEN_BUF2(size)														\
 			do {																\
-				if ((newsize = lensql2 + (size) + 3) > sizesql2) {				\
-					if ((tmp = ast_realloc(sql2, (newsize / 512 + 1) * 512))) {	\
-						sql2 = tmp;												\
-						sizesql2 = (newsize / 512 + 1) * 512;					\
-					} else {													\
-						ast_log(LOG_ERROR, "Unable to allocate sufficient memory.  Insert CDR '%s:%s' failed.\n", tableptr->connection, tableptr->table);	\
+				if (sql2->used + size + 1 > sql2->len) {                        \
+					if (ast_str_make_space(&sql2, ((sql2->len + size + 3) / 512 + 1) * 512) != 0) { \
+						ast_log(LOG_ERROR, "Unable to allocate sufficient memory.  Insert CDR '%s:%s' failed.\n", tableptr->connection, tableptr->table); \
 						ast_free(sql);											\
 						ast_free(sql2);											\
 						AST_RWLIST_UNLOCK(&odbc_tables);						\
@@ -328,9 +322,8 @@
 	struct tables *tableptr;
 	struct columns *entry;
 	struct odbc_obj *obj;
-	int lensql, lensql2, sizesql = maxsize, sizesql2 = maxsize2, newsize;
-	/* Allocated, so we can realloc() */
-	char *sql = ast_calloc(sizeof(char), sizesql), *sql2 = ast_calloc(sizeof(char), sizesql2), *tmp;
+	struct ast_str *sql = ast_str_create(maxsize), *sql2 = ast_str_create(maxsize2);
+	char *tmp;
 	char colbuf[1024], *colptr;
 	SQLHSTMT stmt = NULL;
 	SQLLEN rows = 0;
@@ -351,12 +344,12 @@
 	}
 
 	AST_LIST_TRAVERSE(&odbc_tables, tableptr, list) {
-		lensql = snprintf(sql, sizesql, "INSERT INTO %s (", tableptr->table);
-		lensql2 = snprintf(sql2, sizesql2, " VALUES (");
+		ast_str_set(&sql, 0, "INSERT INTO %s (", tableptr->table);
+		ast_str_set(&sql2, 0, " VALUES (");
 
 		/* No need to check the connection now; we'll handle any failure in prepare_and_execute */
 		if (!(obj = ast_odbc_request_obj(tableptr->connection, 0))) {
-			ast_log(LOG_WARNING, "cdr_adaptive_odbc: Unable to retrieve database handle for '%s:%s'.  CDR failed: %s\n", tableptr->connection, tableptr->table, sql);
+			ast_log(LOG_WARNING, "cdr_adaptive_odbc: Unable to retrieve database handle for '%s:%s'.  CDR failed: %s\n", tableptr->connection, tableptr->table, sql->str);
 			continue;
 		}
 
@@ -407,26 +400,21 @@
 							colptr[entry->octetlen] = '\0';
 					}
 
-					lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+					ast_str_append(&sql, 0, "%s,", entry->name);
 					LENGTHEN_BUF2(strlen(colptr));
 
 					/* Encode value, with escaping */
-					strcpy(sql2 + lensql2, "'");
-					lensql2++;
+					ast_str_append(&sql2, 0, "'");
 					for (tmp = colptr; *tmp; tmp++) {
 						if (*tmp == '\'') {
-							strcpy(sql2 + lensql2, "''");
-							lensql2 += 2;
+							ast_str_append(&sql2, 0, "''");
 						} else if (*tmp == '\\' && ast_odbc_backslash_is_escape(obj)) {
-							strcpy(sql2 + lensql2, "\\\\");
-							lensql2 += 2;
+							ast_str_append(&sql2, 0, "\\\\");
 						} else {
-							sql2[lensql2++] = *tmp;
-							sql2[lensql2] = '\0';
-						}
-					}
-					strcpy(sql2 + lensql2, "',");
-					lensql2 += 2;
+							ast_str_append(&sql2, 0, "%c", *tmp);
+						}
+					}
+					ast_str_append(&sql2, 0, "',");
 					break;
 				case SQL_TYPE_DATE:
 					{
@@ -445,9 +433,9 @@
 						if (year > 0 && year < 100)
 							year += 2000;
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(17);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "{ d '%04d-%02d-%02d' },", year, month, day);
+						ast_str_append(&sql2, 0, "{ d '%04d-%02d-%02d' },", year, month, day);
 					}
 					break;
 				case SQL_TYPE_TIME:
@@ -460,9 +448,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(15);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "{ t '%02d:%02d:%02d' },", hour, minute, second);
+						ast_str_append(&sql2, 0, "{ t '%02d:%02d:%02d' },", hour, minute, second);
 					}
 					break;
 				case SQL_TYPE_TIMESTAMP:
@@ -486,9 +474,9 @@
 						if (year > 0 && year < 100)
 							year += 2000;
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(26);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "{ ts '%04d-%02d-%02d %02d:%02d:%02d' },", year, month, day, hour, minute, second);
+						ast_str_append(&sql2, 0, "{ ts '%04d-%02d-%02d %02d:%02d:%02d' },", year, month, day, hour, minute, second);
 					}
 					break;
 				case SQL_INTEGER:
@@ -499,9 +487,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(12);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%d,", integer);
+						ast_str_append(&sql2, 0, "%d,", integer);
 					}
 					break;
 				case SQL_BIGINT:
@@ -512,9 +500,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(24);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%lld,", integer);
+						ast_str_append(&sql2, 0, "%lld,", integer);
 					}
 					break;
 				case SQL_SMALLINT:
@@ -525,9 +513,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(6);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%d,", integer);
+						ast_str_append(&sql2, 0, "%d,", integer);
 					}
 					break;
 				case SQL_TINYINT:
@@ -538,9 +526,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(4);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%d,", integer);
+						ast_str_append(&sql2, 0, "%d,", integer);
 					}
 					break;
 				case SQL_BIT:
@@ -553,9 +541,9 @@
 						if (integer != 0)
 							integer = 1;
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(2);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%d,", integer);
+						ast_str_append(&sql2, 0, "%d,", integer);
 					}
 					break;
 				case SQL_NUMERIC:
@@ -567,9 +555,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(entry->decimals);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%*.*lf,", entry->decimals, entry->radix, number);
+						ast_str_append(&sql2, 0, "%*.*lf,", entry->decimals, entry->radix, number);
 					}
 					break;
 				case SQL_FLOAT:
@@ -582,9 +570,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(entry->decimals);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%lf,", number);
+						ast_str_append(&sql2, 0, "%lf,", number);
 					}
 					break;
 				default:
@@ -594,20 +582,20 @@
 		}
 
 		/* Concatenate the two constructed buffers */
-		LENGTHEN_BUF1(lensql2);
-		sql[lensql - 1] = ')';
-		sql2[lensql2 - 1] = ')';
-		strcat(sql + lensql, sql2);
-
-		ast_verb(11, "[%s]\n", sql);
-
-		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, sql);
+		LENGTHEN_BUF1(sql2->used);
+		sql->str[sql->used - 1] = ')';
+		sql2->str[sql2->used - 1] = ')';
+		ast_str_append(&sql, 0, "%s", sql2->str);
+
+		ast_verb(11, "[%s]\n", sql->str);
+
+		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, sql->str);
 		if (stmt) {
 			SQLRowCount(stmt, &rows);
 			SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 		}
 		if (rows == 0) {
-			ast_log(LOG_WARNING, "cdr_adaptive_odbc: Insert failed on '%s:%s'.  CDR failed: %s\n", tableptr->connection, tableptr->table, sql);

[... 1796 lines stripped ...]



More information about the svn-commits mailing list