[asterisk-commits] seanbright: branch seanbright/resolve-shadow-warnings r115069 - in /team/sean...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 1 14:35:54 CDT 2008


Author: seanbright
Date: Thu May  1 14:35:54 2008
New Revision: 115069

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115069
Log:
Merged revisions 114830,114832,114834,114841,114845,114849,114852,114857,114866,114874,114876,114884,114888,114892,114899,114904,114906,114912,114922,114926,114931,114977,115018 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r114830 | qwell | 2008-04-29 13:10:55 -0400 (Tue, 29 Apr 2008) | 9 lines

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

........
r114829 | qwell | 2008-04-29 12:08:55 -0500 (Tue, 29 Apr 2008) | 1 line

Change warning message to debug, since there are cases where 0 results is perfectly fine.
........

................
r114832 | mmichelson | 2008-04-29 13:31:26 -0400 (Tue, 29 Apr 2008) | 3 lines

Fix a crash happening in app_directory. This crash would occur if a users.conf existed.


................
r114834 | mmichelson | 2008-04-29 13:56:13 -0400 (Tue, 29 Apr 2008) | 8 lines

Since there is now a globally available function for saying someone's name, a LOT of
functions in app_directory can be removed since the ODBC-specific lookups are accomplished
within app_voicemail. This change greatly reduces the amount of lines in app_directory that
were solely for the purpose of looking up a name when ODBC_STORAGE is specified for voicemail.

This commit also makes the name-saying interruptable via DTMF.


................
r114841 | mmichelson | 2008-04-29 14:48:26 -0400 (Tue, 29 Apr 2008) | 4 lines

Make app_directory dependent on app_voicemail. This is because the function
which says the person's name is handled inside app_voicemail now.


................
r114845 | kpfleming | 2008-04-29 14:58:48 -0400 (Tue, 29 Apr 2008) | 3 lines

fix this logic to actually be correct... the fd can't be *both* -1 and an array index to be checked in rfds/efds (bug found by gcc-4.3)


................
r114849 | mmichelson | 2008-04-29 15:42:04 -0400 (Tue, 29 Apr 2008) | 22 lines

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

........
r114848 | mmichelson | 2008-04-29 14:40:06 -0500 (Tue, 29 Apr 2008) | 14 lines

Use the MACRO_CONTEXT and MACRO_EXTEN channel variables instead of the channel's macrocontext
and macroexten fields. This is needed because if macros are daisy-chained, the incorrect 
context and extension are placed on the new channel. I also added locking to the channel prior
to accessing these variables as noted in trunk's janitor project file.


(closes issue #12549)
Reported by: darren1713
Patches:
      app_queue.c.macroextenpatch uploaded by darren1713 (license 116)
	       (with modifications from me)
Tested by: putnopvut


........

................
r114852 | qwell | 2008-04-29 16:05:48 -0400 (Tue, 29 Apr 2008) | 1 line

Fix formatting
................
r114857 | mmichelson | 2008-04-29 17:07:36 -0400 (Tue, 29 Apr 2008) | 15 lines

Patching app_chanspy to jibe better with what is documented. This allows for 
a colon-delimited list of spygroups to be specified when calling the ChanSpy application
with the 'g' option. Prior to this, you could only specify a single group when using the
'g' option.

I also have upped the maximum number of spygroups to 128 and added a #define so that this
can be easily increased or decreased later.

(closes issue #12497)
Reported by: jsmith
Patches:
      app_chanspy_multiple_groups_v2.patch uploaded by jsmith (license 15)
Tested by: atis, jvandal


................
r114866 | jpeeler | 2008-04-29 18:54:14 -0400 (Tue, 29 Apr 2008) | 2 lines

Fixes a problem where all the templates were marked as dead no matter what. The templates should only be marked as dead if a configuration file has been successfully loaded and has changes. Bug found while making API documentation for 1.6.0.

................
r114874 | tilghman | 2008-04-30 01:05:25 -0400 (Wed, 30 Apr 2008) | 2 lines

Document the Incomplete application addition.

................
r114876 | kpfleming | 2008-04-30 08:15:43 -0400 (Wed, 30 Apr 2008) | 10 lines

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

........
r114875 | kpfleming | 2008-04-30 07:14:07 -0500 (Wed, 30 Apr 2008) | 2 lines

pay attention to *all* header files for dependency tracking, not just the local ones (inspired by r578 of asterisk-addons by tilghman)

........

................
r114884 | kpfleming | 2008-04-30 10:49:51 -0400 (Wed, 30 Apr 2008) | 10 lines

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

........
r114880 | kpfleming | 2008-04-30 09:46:57 -0500 (Wed, 30 Apr 2008) | 2 lines

use the ARRAY_LEN macro for indexing through the iaxs/iaxsl arrays so that the size of the arrays can be adjusted in one place, and change the size of the arrays from 32768 calls to 2048 calls when LOW_MEMORY is defined

........

................
r114888 | jpeeler | 2008-04-30 12:14:43 -0400 (Wed, 30 Apr 2008) | 3 lines

Fixes a bug where if a stream monitor thread was not created (caused from failure of opening or starting the stream) pthread_cancel was called with an invalid thread ID.


................
r114892 | russell | 2008-04-30 12:34:24 -0400 (Wed, 30 Apr 2008) | 36 lines

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

........
r114891 | russell | 2008-04-30 11:30:01 -0500 (Wed, 30 Apr 2008) | 28 lines

Merge changes from team/russell/iax2_find_callno and iax2_find_callno_1.4

These changes address a critical performance issue introduced in the latest
release.  The fix for the latest security issue included a change that made
Asterisk randomly choose call numbers to make them more difficult to guess by
attackers.  However, due to some inefficient (this is by far, an understatement)
code, when Asterisk chose high call numbers, chan_iax2 became unusable after
just a small number of calls.  On a small embedded platform, it would not be
able to handle a single call.  On my Intel Core 2 Duo @ 2.33 GHz, I couldn't
run more than about 16 IAX2 channels.  Ouch.

These changes address some performance issues of the find_callno() function
that have bothered me for a very long time.  On every incoming media frame,
it iterated through every possible call number trying to find a matching
active call.  This involved a mutex lock and unlock for each call number
checked.  So, if the random call number chosen was 20000, then every media
frame would cause 20000 locks and unlocks.  Previously, this problem was
not as obvious since Asterisk always chose the lowest call number it could.

A second container for IAX2 pvt structs has been added.  It is an astobj2
hash table.  When we know the remote side's call number, the pvt goes into
the hash table with a hash value of the remote side's call number.  Then,
lookups for incoming media frames are a very fast hash lookup instead of an
absolutely insane array traversal.

In a quick test, I was able to get more than 3600% more IAX2 channels
on my machine with these changes.

........

................
r114899 | oej | 2008-04-30 12:55:49 -0400 (Wed, 30 Apr 2008) | 15 lines

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

........
r114890 | oej | 2008-04-30 18:23:17 +0200 (Ons, 30 Apr 2008) | 7 lines

Don't crash on bad SIP replys.
Fix created in Huntsville together with Mark M (putnopvut)

(closes issue #12363)
Reported by: jvandal
Tested by: putnopvut, oej

........

................
r114904 | tilghman | 2008-04-30 15:21:04 -0400 (Wed, 30 Apr 2008) | 8 lines

Lock around variables retrieved, and copy the values, if they stay persistent,
since another thread could remove them.
(closes issue #12541)
 Reported by: snuffy
 Patches: 
       bug_12156_apps.diff uploaded by snuffy (license 35)
       Several additional changes by me

................
r114906 | mmichelson | 2008-04-30 15:30:41 -0400 (Wed, 30 Apr 2008) | 12 lines

Adding new configuration options to app_queue. This adds two new values
to announce-position, "limit" and "more," as well as a new option, 
announce-position-limit. For more information on the use of these options,
see CHANGES or configs/queues.conf.sample.

(closes issue #10991)
Reported by: slavon
Patches:
      app_q.diff uploaded by slavon (license 288)
Tested by: slavon, putnopvut


................
r114912 | file | 2008-04-30 16:51:17 -0400 (Wed, 30 Apr 2008) | 2 lines

Add support for specifying the registration expiry on a per registration basis in the register line. This comes from a Switchvox patch. (issue AST-24)

................
r114922 | qwell | 2008-05-01 12:49:24 -0400 (Thu, 01 May 2008) | 10 lines

Allow dringXrange to properly default to 10, as was done in 1.4.

dringXrange is a new feature that was added, and it attempted to default, but only when the option was specified.

(closes issue #12536)
Reported by: bjm
Patches:
      12536-dringXrange.diff uploaded by qwell (license 4)
Tested by: bjm

................
r114926 | bbryant | 2008-05-01 12:57:19 -0400 (Thu, 01 May 2008) | 7 lines

Add two new dialplan functions from libspeex for applying audio gain control 
and denoising to a channel, AGC() and DENOISE(). Also included, is a change 
to the audiohook API to add a new function (ast_audiohook_remove) that can 
remove an audiohook from a channel before it is detached.

This code is based on a contribution from Switchvox.

................
r114931 | russell | 2008-05-01 13:28:25 -0400 (Thu, 01 May 2008) | 4 lines

Clarify the deprecation notice about Macro() to note that it will not be removed
for the sake of backwards compatibility, since it is a non-trivial task to convert
existing large dialplans that depend on Macro() to use GoSub(), instead.

................
r114977 | bbryant | 2008-05-01 14:28:38 -0400 (Thu, 01 May 2008) | 4 lines

Add "read" capability to new libspeex functions in func_speex.c.

func_speex.c is based on contributions from Switchvox.

................
r115018 | tilghman | 2008-05-01 15:00:18 -0400 (Thu, 01 May 2008) | 14 lines

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

........
r115017 | tilghman | 2008-05-01 13:59:08 -0500 (Thu, 01 May 2008) | 6 lines

'#' is another reserved character for URIs that also needs to be escaped.
(closes issue #10543)
 Reported by: blitzrage
 Patches: 
       20080418__bug10543.diff.txt uploaded by Corydon76 (license 14)

........

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

Added:
    team/seanbright/resolve-shadow-warnings/funcs/func_speex.c
      - copied unchanged from r115018, trunk/funcs/func_speex.c
Modified:
    team/seanbright/resolve-shadow-warnings/   (props changed)
    team/seanbright/resolve-shadow-warnings/CHANGES
    team/seanbright/resolve-shadow-warnings/Makefile.rules
    team/seanbright/resolve-shadow-warnings/UPGRADE.txt
    team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c
    team/seanbright/resolve-shadow-warnings/apps/app_directory.c
    team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c
    team/seanbright/resolve-shadow-warnings/apps/app_macro.c
    team/seanbright/resolve-shadow-warnings/apps/app_meetme.c
    team/seanbright/resolve-shadow-warnings/apps/app_minivm.c
    team/seanbright/resolve-shadow-warnings/apps/app_morsecode.c
    team/seanbright/resolve-shadow-warnings/apps/app_queue.c
    team/seanbright/resolve-shadow-warnings/apps/app_speech_utils.c
    team/seanbright/resolve-shadow-warnings/apps/app_stack.c
    team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c
    team/seanbright/resolve-shadow-warnings/apps/app_while.c
    team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c
    team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
    team/seanbright/resolve-shadow-warnings/channels/chan_skinny.c
    team/seanbright/resolve-shadow-warnings/channels/chan_zap.c
    team/seanbright/resolve-shadow-warnings/channels/iax2-provision.c
    team/seanbright/resolve-shadow-warnings/channels/iax2.h
    team/seanbright/resolve-shadow-warnings/configs/queues.conf.sample
    team/seanbright/resolve-shadow-warnings/configs/sip.conf.sample
    team/seanbright/resolve-shadow-warnings/include/asterisk/audiohook.h
    team/seanbright/resolve-shadow-warnings/main/audiohook.c
    team/seanbright/resolve-shadow-warnings/main/features.c
    team/seanbright/resolve-shadow-warnings/main/utils.c
    team/seanbright/resolve-shadow-warnings/phoneprov/polycom.xml
    team/seanbright/resolve-shadow-warnings/res/res_config_pgsql.c

Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu May  1 14:35:54 2008
@@ -1,1 +1,1 @@
-/trunk:1-114826
+/trunk:1-115020

Modified: team/seanbright/resolve-shadow-warnings/CHANGES
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/CHANGES?view=diff&rev=115069&r1=115068&r2=115069
==============================================================================
--- team/seanbright/resolve-shadow-warnings/CHANGES (original)
+++ team/seanbright/resolve-shadow-warnings/CHANGES Thu May  1 14:35:54 2008
@@ -7,6 +7,9 @@
  * Added a new dialplan function, AST_CONFIG(), which allows you to access
    variables from an Asterisk configuration file.
  * The JACK_HOOK function now has a c() option to supply a custom client name.
+ * Added two new dialplan functions from libspeex for audio gain control and 
+   denoise, AGC() and DENOISE(). Both functions can be applied to the tx and 
+   rx directions of a channel from the dialplan.
 
 Zaptel channel driver (chan_zap) Changes
 ----------------------------------------
@@ -18,6 +21,13 @@
  * It is now possible to specify a pattern match as a hint. Once a phone subscribes
    to something that matches the pattern a hint will be created using the contents
    and variables evaluated.
+ * Dialplan matching has been extended to allow an extension to return to the
+   PBX core to wait for more digits.  This is done by using the new dialplan
+   application called "Incomplete".  This will permit a whole new level of
+   extension control, by giving the administrator more control over early
+   matches employing one of the short-circuit pattern match operators.  Note
+   that custom applications can trigger this same behavior by returning the
+   special value AST_PBX_INCOMPLETE.
 
 Application Changes
 -------------------
@@ -56,6 +66,8 @@
    and restore this performance improvement. Astobj2 refcounting is now used
    for users, peers, and dialogs.  Users are encouraged to assist in regression
    testing and problem reporting!
+ * Added ability to specify registration expiry time on a per registration basis in
+   the register line.
 
 IAX Changes
 -----------
@@ -410,6 +422,12 @@
   * New configuration option: randomperiodicannounce. If a list of periodic announcements is
     specified by the periodic-announce option, then one will be chosen randomly when it is time
 	to play a periodic announcment
+  * New configuration options: announce-position now takes two more values in addition to "yes" and
+    "no." Two new options, "limit" and "more," are allowed. These are tied to another option,
+	announce-position-limit. By setting announce-position to "limit" callers will only have their
+	position announced if their position is less than what is specified by announce-position-limit.
+	If announce-position is set to "more" then callers beyond the position specified by announce-position-limit
+	will be told that their are more than announce-position-limit callers waiting.
 
 MeetMe Changes
 --------------

Modified: team/seanbright/resolve-shadow-warnings/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/Makefile.rules?view=diff&rev=115069&r1=115068&r2=115069
==============================================================================
--- team/seanbright/resolve-shadow-warnings/Makefile.rules (original)
+++ team/seanbright/resolve-shadow-warnings/Makefile.rules Thu May  1 14:35:54 2008
@@ -21,7 +21,7 @@
 .PHONY: dist-clean
 
 # extra cflags to build dependencies. Recursively expanded.
-MAKE_DEPS= -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
 
 ifeq ($(NOISY_BUILD),)
     ECHO_PREFIX=@

Modified: team/seanbright/resolve-shadow-warnings/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/UPGRADE.txt?view=diff&rev=115069&r1=115068&r2=115069
==============================================================================
--- team/seanbright/resolve-shadow-warnings/UPGRADE.txt (original)
+++ team/seanbright/resolve-shadow-warnings/UPGRADE.txt Thu May  1 14:35:54 2008
@@ -92,7 +92,12 @@
   Gosub()/Return() applications.  To replace MacroExclusive(), we have
   introduced dialplan functions LOCK(), TRYLOCK(), and UNLOCK().  You may use
   these functions in any location where you desire to ensure that only one
-  channel is executing that path at any one time.
+  channel is executing that path at any one time.  The Macro() applications
+  are deprecated for performance reasons.  However, since Macro() has been
+  around for a long time and so many dialplans depend heavily on it, it will
+  not be removed for the sake of backwards compatibility.  It is also worth
+  noting that using both Macro() and GoSub() at the same time is _heavily_
+  discouraged.
 * Read() now sets a READSTATUS variable on exit.  It does NOT automatically
   return -1 (and hangup) anymore on error.  If you want to hangup on error,
   you need to do so explicitly in your dialplan.
@@ -103,6 +108,8 @@
 * WaitMusicOnHold application is now deprecated in favor of extended MusicOnHold.
 * SetMusicOnHold is now deprecated. You should use Set(CHANNEL(musicclass)=...)
   instead.
+* While app_directory has always relied on having a voicemail.conf or users.conf file
+  correctly set up, it now is dependent on app_voicemail being compiled as well.
 
 Dialplan Functions:
 

Modified: team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c?view=diff&rev=115069&r1=115068&r2=115069
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_chanspy.c Thu May  1 14:35:54 2008
@@ -49,6 +49,7 @@
 #include "asterisk/lock.h"
 
 #define AST_NAME_STRLEN 256
+#define NUM_SPYGROUPS 128
 
 static const char *tdesc = "Listen to a channel, and optionally whisper into it";
 static const char *app_chan = "ChanSpy";
@@ -70,8 +71,12 @@
 "        and a digit sequence.\n"
 "  Options:\n"
 "    b                      - Only spy on channels involved in a bridged call.\n"
-"    g(grp)                 - Match only channels where their SPYGROUP variable is set to\n"
-"                             contain 'grp' in an optional : delimited list.\n"
+"    g(grp)                 - Only spy on channels in which one or more of the groups \n"
+"                             listed in 'grp' matches one or more groups from the\n"
+"                             SPYGROUP variable set on the channel to be spied upon.\n"
+"                             Note that both 'grp' and SPYGROUP can contain either a\n"
+"                             single group or a colon-delimited list of groups, such\n"
+"                             as 'sales:support:accounting'.\n"
 "    n([mailbox][@context]) - Say the name of the person being spied on if that person has recorded\n"
 "                             his/her name. If a context is specified, then that voicemail context will\n"
 "                             be searched when retrieving the name, otherwise the \"default\" context\n"
@@ -119,8 +124,12 @@
 "        exit to it.\n"
 "  Options:\n"
 "    b                      - Only spy on channels involved in a bridged call.\n"
-"    g(grp)                 - Match only channels where their ${SPYGROUP} variable is set to\n"
-"                             contain 'grp' in an optional : delimited list.\n"
+"    g(grp)                 - Only spy on channels in which one or more of the groups \n"
+"                             listed in 'grp' matches one or more groups from the\n"
+"                             SPYGROUP variable set on the channel to be spied upon.\n"
+"                             Note that both 'grp' and SPYGROUP can contain either a\n"
+"                             single group or a colon-delimited list of groups, such\n"
+"                             as 'sales:support:accounting'.\n"
 "    n([mailbox][@context]) - Say the name of the person being spied on if that person has recorded\n"
 "                             his/her name. If a context is specified, then that voicemail context will\n"
 "                             be searched when retrieving the name, otherwise the \"default\" context\n"
@@ -587,12 +596,15 @@
 
 	if (ast_test_flag(flags, OPTION_EXIT)) {
 		const char *c;
-		if ((c = pbx_builtin_getvar_helper(chan, "SPY_EXIT_CONTEXT")))
+		ast_channel_lock(chan);
+		if ((c = pbx_builtin_getvar_helper(chan, "SPY_EXIT_CONTEXT"))) {
 			ast_copy_string(exitcontext, c, sizeof(exitcontext));
-		else if (!ast_strlen_zero(chan->macrocontext))
+		} else if (!ast_strlen_zero(chan->macrocontext)) {
 			ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext));
-		else
+		} else {
 			ast_copy_string(exitcontext, chan->context, sizeof(exitcontext));
+		}
+		ast_channel_unlock(chan);
 	}
 
 	ast_mutex_init(&chanspy_ds.lock);
@@ -653,10 +665,14 @@
 			 	next_channel(chan, prev, spec, exten, context, &chanspy_ds), next_chanspy_ds = NULL) {
 			const char *group;
 			int igrp = !mygroup;
-			char *groups[25];
+			char *groups[NUM_SPYGROUPS];
+			char *mygroups[NUM_SPYGROUPS];
 			int num_groups = 0;
 			char *dup_group;
+			int num_mygroups = 0;
+			char *dup_mygroup;
 			int x;
+			int y;
 			char *s;
 			char *buffer;
 			char *end;
@@ -691,16 +707,22 @@
 			}
 
 			if (mygroup) {
+				dup_mygroup = ast_strdupa(mygroup);
+				num_mygroups = ast_app_separate_args(dup_mygroup, ':', mygroups,
+					sizeof(mygroups) / sizeof(mygroups[0]));
+
 				if ((group = pbx_builtin_getvar_helper(peer, "SPYGROUP"))) {
 					dup_group = ast_strdupa(group);
 					num_groups = ast_app_separate_args(dup_group, ':', groups,
 						sizeof(groups) / sizeof(groups[0]));
 				}
 
-				for (x = 0; x < num_groups; x++) {
-					if (!strcmp(mygroup, groups[x])) {
-						igrp = 1;
-						break;
+				for (y = 0; y < num_mygroups; y++) {
+					for (x = 0; x < num_groups; x++) {
+						if (!strcmp(mygroups[y], groups[x])) {
+							igrp = 1;
+							break;
+						}
 					}
 				}
 			}

Modified: team/seanbright/resolve-shadow-warnings/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_directory.c?view=diff&rev=115069&r1=115068&r2=115069
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_directory.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_directory.c Thu May  1 14:35:54 2008
@@ -25,6 +25,9 @@
  * \ingroup applications
  */
 
+/*** MODULEINFO
+	<depend>app_voicemail</depend>
+ ***/
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -38,15 +41,6 @@
 #include "asterisk/say.h"
 #include "asterisk/app.h"
 #include "asterisk/utils.h"
-
-#ifdef ODBC_STORAGE
-#include <sys/mman.h>
-#include "asterisk/res_odbc.h"
-
-static char odbc_database[80] = "asterisk";
-static char odbc_table[80] = "voicemessages";
-static char vmfmts[80] = "wav";
-#endif
 
 static char *app = "Directory";
 
@@ -133,121 +127,6 @@
 	AST_APP_OPTION('m', OPT_SELECTFROMMENU),
 });
 
-#ifdef ODBC_STORAGE
-struct generic_prepare_struct {
-	const char *sql;
-	const char *param;
-};
-
-static SQLHSTMT generic_prepare(struct odbc_obj *obj, void *data)
-{
-	struct generic_prepare_struct *gps = data;
-	SQLHSTMT stmt;
-	int res;
-
-	res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
-	if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-		ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
-		return NULL;
-	}
-
-	res = SQLPrepare(stmt, (unsigned char *)gps->sql, SQL_NTS);
-	if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-		ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", (char *)gps->sql);
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-		return NULL;
-	}
-
-	if (!ast_strlen_zero(gps->param))
-		SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(gps->param), 0, (void *)gps->param, 0, NULL);
-
-	return stmt;
-}
-
-static void retrieve_file(char *dir)
-{
-	int x = 0;
-	int res;
-	int fd=-1;
-	size_t fdlen = 0;
-	void *fdm = MAP_FAILED;
-	SQLHSTMT stmt;
-	char sql[256];
-	char fmt[80]="", empty[10] = "";
-	char *c;
-	SQLLEN colsize;
-	char full_fn[256];
-	struct odbc_obj *obj;
-	struct generic_prepare_struct gps = { .sql = sql, .param = dir };
-
-	obj = ast_odbc_request_obj(odbc_database, 1);
-	if (obj) {
-		do {
-			ast_copy_string(fmt, vmfmts, sizeof(fmt));
-			c = strchr(fmt, '|');
-			if (c)
-				*c = '\0';
-			if (!strcasecmp(fmt, "wav49"))
-				strcpy(fmt, "WAV");
-			snprintf(full_fn, sizeof(full_fn), "%s.%s", dir, fmt);
-			snprintf(sql, sizeof(sql), "SELECT recording FROM %s WHERE dir=? AND msgnum=-1", odbc_table);
-			stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
-
-			if (!stmt) {
-				ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
-				break;
-			}
-			res = SQLFetch(stmt);
-			if (res == SQL_NO_DATA) {
-				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-				break;
-			} else if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-				ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
-				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-				break;
-			}
-			fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, AST_FILE_MODE);
-			if (fd < 0) {
-				ast_log(LOG_WARNING, "Failed to write '%s': %s\n", full_fn, strerror(errno));
-				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-				break;
-			}
-
-			res = SQLGetData(stmt, 1, SQL_BINARY, empty, 0, &colsize);
-			fdlen = colsize;
-			if (fd > -1) {
-				char tmp[1]="";
-				lseek(fd, fdlen - 1, SEEK_SET);
-				if (write(fd, tmp, 1) != 1) {
-					close(fd);
-					fd = -1;
-					break;
-				}
-				if (fd > -1)
-					fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-			}
-			if (fdm != MAP_FAILED) {
-				memset(fdm, 0, fdlen);
-				res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, fdlen, &colsize);
-				if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
-					ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
-					SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-					break;
-				}
-			}
-			SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-		} while (0);
-		ast_odbc_release_obj(obj);
-	} else
-		ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
-	if (fdm != MAP_FAILED)
-		munmap(fdm, fdlen);
-	if (fd > -1)
-		close(fd);
-	return;
-}
-#endif
-
 static int compare(const char *text, const char *template)
 {
 	char digit;
@@ -333,26 +212,7 @@
 	const char *ext, const char *name, struct ast_flags *flags)
 {
 	int res = 0;
-	char fn[256];
-
-	/* Check for the VoiceMail2 greeting first */
-	snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet",
-		ast_config_AST_SPOOL_DIR, context, ext);
-#ifdef ODBC_STORAGE
-	retrieve_file(fn);
-#endif
-
-	if (ast_fileexists(fn, NULL, chan->language) <= 0) {
-		/* no file, check for an old-style Voicemail greeting */
-		snprintf(fn, sizeof(fn), "%s/vm/%s/greet",
-			ast_config_AST_SPOOL_DIR, ext);
-	}
-#ifdef ODBC_STORAGE
-	retrieve_file(fn);
-#endif
-
-	if (ast_fileexists(fn, NULL, chan->language) > 0) {
-		res = ast_stream_and_wait(chan, fn, AST_DIGIT_ANY);
+	if ((res = ast_app_sayname(chan, ext, context)) >= 0) {
 		ast_stopstream(chan);
 		/* If Option 'e' was specified, also read the extension number with the name */
 		if (ast_test_flag(flags, OPT_SAYEXTENSION)) {
@@ -366,9 +226,6 @@
 			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
 		}
 	}
-#ifdef ODBC_STORAGE
-	ast_filedelete(fn, NULL);
-#endif
 
 	return res;
 }
@@ -625,7 +482,6 @@
 		AST_LIST_INSERT_TAIL(alist, item, entry);
 	}
 
-
 	if (ucfg) {
 		for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
 			const char *position;
@@ -641,10 +497,10 @@
 
 			res = 0;
 			if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
-				res = check_match(&item, position, v->name, ext, 0 /* use_first_name */);
+				res = check_match(&item, position, cat, ext, 0 /* use_first_name */);
 			}
 			if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
-				res = check_match(&item, position, v->name, ext, 1 /* use_first_name */);
+				res = check_match(&item, position, cat, ext, 1 /* use_first_name */);
 			}
 
 			if (!res)
@@ -655,7 +511,6 @@
 			AST_LIST_INSERT_TAIL(alist, item, entry);
 		}
 	}
-
 	return 0;
 }
 
@@ -910,26 +765,6 @@
 
 static int load_module(void)
 {
-#ifdef ODBC_STORAGE
-	struct ast_flags config_flags = { 0 };
-	struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);
-	const char *tmp;
-
-	if (cfg) {
-		if ((tmp = ast_variable_retrieve(cfg, "general", "odbcstorage"))) {
-			ast_copy_string(odbc_database, tmp, sizeof(odbc_database));
-		}
-		if ((tmp = ast_variable_retrieve(cfg, "general", "odbctable"))) {
-			ast_copy_string(odbc_table, tmp, sizeof(odbc_table));
-		}
-		if ((tmp = ast_variable_retrieve(cfg, "general", "format"))) {
-			ast_copy_string(vmfmts, tmp, sizeof(vmfmts));
-		}
-		ast_config_destroy(cfg);
-	} else
-		ast_log(LOG_WARNING, "Unable to load " VOICEMAIL_CONFIG " - ODBC defaults will be used\n");
-#endif
-
 	return ast_register_application(app, directory_exec, synopsis, descrip);
 }
 

Modified: team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c?view=diff&rev=115069&r1=115068&r2=115069
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_externalivr.c Thu May  1 14:35:54 2008
@@ -251,10 +251,13 @@
 			break;
 		}
 		
-		value = pbx_builtin_getvar_helper(chan, variable);
-		if(!value)
+		ast_channel_lock(chan);
+		if (!(value = pbx_builtin_getvar_helper(chan, variable))) {
 			value = "";
+		}
+
 		ast_str_append(&newstring, 0, "%s=%s,", variable, value);
+		ast_channel_unlock(chan);
 		ast_copy_string(outbuf, newstring->str, outbuflen);
 	}
 };

Modified: team/seanbright/resolve-shadow-warnings/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_macro.c?view=diff&rev=115069&r1=115068&r2=115069
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_macro.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_macro.c Thu May  1 14:35:54 2008
@@ -165,20 +165,24 @@
 	}
 
 	/* does the user want a deeper rabbit hole? */
-	s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
-	if (s)
+	ast_channel_lock(chan);
+	if ((s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION"))) {
 		sscanf(s, "%d", &maxdepth);
-
+	}
+	
 	/* Count how many levels deep the rabbit hole goes */
-	s = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
-	if (s)
+	if ((s = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH"))) {
 		sscanf(s, "%d", &depth);
+	}
+	
 	/* Used for detecting whether to return when a Macro is called from another Macro after hangup */
 	if (strcmp(chan->exten, "h") == 0)
 		pbx_builtin_setvar_helper(chan, "MACRO_IN_HANGUP", "1");
-	inhangupc = pbx_builtin_getvar_helper(chan, "MACRO_IN_HANGUP");
-	if (!ast_strlen_zero(inhangupc))
+	
+	if ((inhangupc = pbx_builtin_getvar_helper(chan, "MACRO_IN_HANGUP"))) {
 		sscanf(inhangupc, "%d", &inhangup);
+	}
+	ast_channel_unlock(chan);
 
 	if (depth >= maxdepth) {
 		ast_log(LOG_ERROR, "Macro():  possible infinite loop detected.  Returning early.\n");
@@ -247,17 +251,19 @@
 	ast_copy_string(chan->context, fullmacro, sizeof(chan->context));
 	chan->priority = 1;
 
+	ast_channel_lock(chan);
 	while((cur = strsep(&rest, ",")) && (argc < MAX_ARGS)) {
 		const char *argp;
   		/* Save copy of old arguments if we're overwriting some, otherwise
 	   	let them pass through to the other macro */
   		snprintf(varname, sizeof(varname), "ARG%d", argc);
-		argp = pbx_builtin_getvar_helper(chan, varname);
-		if (argp)
+		if ((argp = pbx_builtin_getvar_helper(chan, varname))) {
 			oldargs[argc] = ast_strdup(argp);
+		}
 		pbx_builtin_setvar_helper(chan, varname, cur);
 		argc++;
 	}
+	ast_channel_unlock(chan);
 	autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
 	ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
 	while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
@@ -431,6 +437,7 @@
 			/* Copy the extension, so long as we're not in softhangup, where we could be given an asyncgoto */
 			const char *offsets;
 			ast_copy_string(chan->exten, oldexten, sizeof(chan->exten));
+			ast_channel_lock(chan);
 			if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) {
 				/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
 			   	normally if there is any problem */
@@ -440,6 +447,7 @@
 					}
 				}
 			}
+			ast_channel_unlock(chan);
 		}
 	}
 

Modified: team/seanbright/resolve-shadow-warnings/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_meetme.c?view=diff&rev=115069&r1=115068&r2=115069
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_meetme.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_meetme.c Thu May  1 14:35:54 2008
@@ -374,8 +374,8 @@
 	pthread_t recordthread;                 /*!< thread for recording */
 	ast_mutex_t recordthreadlock;           /*!< control threads trying to start recordthread */
 	pthread_attr_t attr;                    /*!< thread attribute */
-	const char *recordingfilename;          /*!< Filename to record the Conference into */
-	const char *recordingformat;            /*!< Format to record the Conference in */
+	char *recordingfilename;                /*!< Filename to record the Conference into */
+	char *recordingformat;                  /*!< Format to record the Conference in */
 	char pin[MAX_PIN];                      /*!< If protected by a PIN */
 	char pinadmin[MAX_PIN];                 /*!< If protected by a admin PIN */
 	char uniqueid[32];
@@ -1350,7 +1350,12 @@
 		ast_hangup(conf->chan);
 	if (conf->fd >= 0)
 		close(conf->fd);
-
+	if (conf->recordingfilename) {
+		ast_free(conf->recordingfilename);
+	}
+	if (conf->recordingformat) {
+		ast_free(conf->recordingformat);
+	}
 	ast_mutex_destroy(&conf->playlock);
 	ast_mutex_destroy(&conf->listenlock);
 	ast_mutex_destroy(&conf->recordthreadlock);
@@ -1507,8 +1512,8 @@
 	struct timeval now;
 	struct ast_dsp *dsp = NULL;
 	struct ast_app *agi_app;
-	const char *agifile;
-	const char *agifiledefault = "conf-background.agi";
+	char *agifile;
+	const char *agifiledefault = "conf-background.agi", *tmpvar;
 	char meetmesecs[30] = "";
 	char exitcontext[AST_MAX_CONTEXT] = "";
 	char recordingtmp[AST_MAX_EXTENSION] = "";
@@ -1575,12 +1580,22 @@
  					play_warning = warning_freq = 0;
  			}
  		}
- 			
- 		var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_WARNING_FILE");
+ 		
+		ast_channel_lock(chan);
+		if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_WARNING_FILE"))) {
+			var = ast_strdupa(var);
+		}
+		ast_channel_unlock(chan);
+
  		warning_sound = var ? var : "timeleft";
  		
- 		var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_TIMEOUT_FILE");
- 		end_sound = var ? var : NULL;
+		ast_channel_lock(chan);
+		if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_TIMEOUT_FILE"))) {
+			var = ast_strdupa(var);
+		}
+		ast_channel_unlock(chan);
+ 		
+		end_sound = var ? var : NULL;
  			
  		/* undo effect of S(x) in case they are both used */
  		calldurationlimit = 0;
@@ -1608,15 +1623,21 @@
 	
 	if (confflags & CONFFLAG_RECORDCONF) {
 		if (!conf->recordingfilename) {
-			conf->recordingfilename = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE");
+			const char *var;
+			ast_channel_lock(chan);
+			if ((var = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE"))) {
+				conf->recordingfilename = ast_strdup(var);
+			}
+			if ((var = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFORMAT"))) {
+				conf->recordingformat = ast_strdup(var);
+			}
+			ast_channel_unlock(chan);
 			if (!conf->recordingfilename) {
 				snprintf(recordingtmp, sizeof(recordingtmp), "meetme-conf-rec-%s-%s", conf->confno, chan->uniqueid);
-				conf->recordingfilename = ast_strdupa(recordingtmp);
+				conf->recordingfilename = ast_strdup(recordingtmp);
 			}
-			conf->recordingformat = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFORMAT");
 			if (!conf->recordingformat) {
-				ast_copy_string(recordingtmp, "wav", sizeof(recordingtmp));
-				conf->recordingformat = ast_strdupa(recordingtmp);
+				conf->recordingformat = ast_strdup("wav");
 			}
 			ast_verb(4, "Starting recording of MeetMe Conference %s into file %s.%s.\n",
 				    conf->confno, conf->recordingfilename, conf->recordingformat);
@@ -1736,12 +1757,15 @@
 	pbx_builtin_setvar_helper(chan, "MEETMEUNIQUEID", conf->uniqueid);
 
 	if (confflags & CONFFLAG_EXIT_CONTEXT) {
-		if ((agifile = pbx_builtin_getvar_helper(chan, "MEETME_EXIT_CONTEXT"))) 
-			ast_copy_string(exitcontext, agifile, sizeof(exitcontext));
-		else if (!ast_strlen_zero(chan->macrocontext)) 
+		ast_channel_lock(chan);
+		if ((tmpvar = pbx_builtin_getvar_helper(chan, "MEETME_EXIT_CONTEXT"))) {
+			ast_copy_string(exitcontext, tmpvar, sizeof(exitcontext));
+		} else if (!ast_strlen_zero(chan->macrocontext)) {
 			ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext));
-		else
+		} else {
 			ast_copy_string(exitcontext, chan->context, sizeof(exitcontext));
+		}
+		ast_channel_unlock(chan);
 	}
 
 	if (!(confflags & (CONFFLAG_QUIET | CONFFLAG_NOONLYPERSON))) {
@@ -1932,10 +1956,14 @@
 		/* Get name of AGI file to run from $(MEETME_AGI_BACKGROUND)
 		   or use default filename of conf-background.agi */
 
-		agifile = pbx_builtin_getvar_helper(chan, "MEETME_AGI_BACKGROUND");
-		if (!agifile)
-			agifile = agifiledefault;
-
+		ast_channel_lock(chan);
+		if ((tmpvar = pbx_builtin_getvar_helper(chan, "MEETME_AGI_BACKGROUND"))) {
+			agifile = ast_strdupa(tmpvar);
+		} else {
+			agifile = ast_strdupa(agifiledefault);
+		}
+		ast_channel_unlock(chan);
+		
 		if (user->zapchannel) {
 			/*  Set CONFMUTE mode on Zap channel to mute DTMF tones */
 			x = 1;
@@ -1944,8 +1972,7 @@
 		/* Find a pointer to the agi app and execute the script */
 		agi_app = pbx_findapp("agi");
 		if (agi_app) {
-			char *s = ast_strdupa(agifile);
-			ret = pbx_exec(chan, agi_app, s);
+			ret = pbx_exec(chan, agi_app, agifile);
 		} else {
 			ast_log(LOG_WARNING, "Could not find application (agi)\n");
 			ret = -2;

Modified: team/seanbright/resolve-shadow-warnings/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_minivm.c?view=diff&rev=115069&r1=115068&r2=115069

[... 1388 lines stripped ...]



More information about the asterisk-commits mailing list