[asterisk-commits] russell: branch russell/issue_8637 r51239 - in /team/russell/issue_8637: ./ a...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 18 11:06:29 MST 2007


Author: russell
Date: Thu Jan 18 12:06:28 2007
New Revision: 51239

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51239
Log:
Merged revisions 50867,50895,50921,50957,50988,50994,51030,51057,51087,51146,51148,51150,51159,51162,51165,51167,51170,51172,51176,51182,51186,51195,51198,51204-51205,51211,51213,51233,51236 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r50867 | kpfleming | 2007-01-15 09:03:06 -0600 (Mon, 15 Jan 2007) | 2 lines

use the ACX_PTHREAD macro from the Autoconf macro archive for setting up compiler pthreads support... should improve portability to platforms with unusual pthreads requirements

................
r50895 | file | 2007-01-15 10:36:07 -0600 (Mon, 15 Jan 2007) | 2 lines

Move event processing into do_message so that it gets executed again when events are tripped.

................
r50921 | qwell | 2007-01-15 12:23:21 -0600 (Mon, 15 Jan 2007) | 2 lines

re-add deprecated "show version" CLI command.

................
r50957 | mogorman | 2007-01-15 15:08:07 -0600 (Mon, 15 Jan 2007) | 12 lines

Merged revisions 50946 via svnmerge from 
https://svn.digium.com/svn/asterisk/branches/1.2

........
r50946 | mogorman | 2007-01-15 14:44:53 -0600 (Mon, 15 Jan 2007) | 4 lines

Solves issue with forwarding voicemails from folders other than inbox.
patch by anthonyl.


........

................
r50988 | tilghman | 2007-01-15 17:10:08 -0600 (Mon, 15 Jan 2007) | 9 lines

Blocked revisions 50987 via svnmerge

........
r50987 | tilghman | 2007-01-15 17:09:02 -0600 (Mon, 15 Jan 2007) | 2 lines

Check return value before dereferencing (Bug 8822)

........

................
r50994 | russell | 2007-01-15 17:49:48 -0600 (Mon, 15 Jan 2007) | 2 lines

Filter out a few CFLAGS that are not valid CXXFLAGS.

................
r51030 | mogorman | 2007-01-15 18:22:09 -0600 (Mon, 15 Jan 2007) | 1 line

Patch allows for changing voicemail password in users.conf from voicemail main, written by AnthonyL  bug #8436
................
r51057 | russell | 2007-01-15 19:15:44 -0600 (Mon, 15 Jan 2007) | 3 lines

It is possible for the config pointer to be NULL here, so it needs to be
checked before dereferencing it.

................
r51087 | file | 2007-01-15 23:55:23 -0600 (Mon, 15 Jan 2007) | 10 lines

Merged revisions 51085 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51085 | file | 2007-01-16 00:53:31 -0500 (Tue, 16 Jan 2007) | 2 lines

Add none as a valid callgroup/pickupgroup option. I consider it a bug that it would inherit it all the way down and not have any way to reset it to nothing - so that's why it is in 1.2. (issue #8296 reported by gkloepfer)

........

................
r51146 | qwell | 2007-01-16 11:36:53 -0600 (Tue, 16 Jan 2007) | 6 lines

Display more useful output when streaming files.

Include the channel name to which the file is being played.

Issue 8828, patch by junky.

................
r51148 | file | 2007-01-16 11:39:50 -0600 (Tue, 16 Jan 2007) | 10 lines

Merged revisions 51145 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51145 | file | 2007-01-16 12:36:50 -0500 (Tue, 16 Jan 2007) | 2 lines

Return previous behavior. ParkedCalls will be able to do DTMF based transfers again. trunk however will get an option to allow this to be set on/off. (issue #8804 reported by nortex)

........

................
r51150 | mogorman | 2007-01-16 11:46:12 -0600 (Tue, 16 Jan 2007) | 2 lines

minor things i missed before i get jumped on

................
r51159 | tilghman | 2007-01-16 15:28:39 -0600 (Tue, 16 Jan 2007) | 10 lines

Merged revisions 51158 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51158 | tilghman | 2007-01-16 15:26:06 -0600 (Tue, 16 Jan 2007) | 2 lines

Postgres driver doesn't like a NULL pointer when retrieving the length (Bug 8513)

........

................
r51162 | tilghman | 2007-01-16 15:51:15 -0600 (Tue, 16 Jan 2007) | 10 lines

Merged revisions 51161 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51161 | tilghman | 2007-01-16 15:50:04 -0600 (Tue, 16 Jan 2007) | 2 lines

Add documentation walkthrough on getting Postgres to work with voicemail (from Issue 8513)

........

................
r51165 | qwell | 2007-01-16 16:07:53 -0600 (Tue, 16 Jan 2007) | 2 lines

change documentation to reflect new procedure in 1.4/trunk

................
r51167 | qwell | 2007-01-16 16:50:19 -0600 (Tue, 16 Jan 2007) | 6 lines

Fix an issue with IMAP storage and realtime voicemail.

Also update the vmdb sql script for IMAP specific options.

Issue 8819, initial patches by bsmithurst (slightly modified by me)

................
r51170 | qwell | 2007-01-16 18:20:56 -0600 (Tue, 16 Jan 2007) | 4 lines

Fix issue with dtmf continuation packets when the dtmf digit is 0...

Issue 8831

................
r51172 | file | 2007-01-16 18:46:29 -0600 (Tue, 16 Jan 2007) | 2 lines

Move rescheduling of lagrq/pings into the scheduler callback.

................
r51176 | kpfleming | 2007-01-16 19:29:12 -0600 (Tue, 16 Jan 2007) | 2 lines

a few more coding style cleanups and one bug fix (from AnthonyL)

................
r51182 | file | 2007-01-17 00:36:41 -0600 (Wed, 17 Jan 2007) | 2 lines

Return the correct result when directly writing out a packet so that the core doesn't then decide to handle it the regular way again. (issue #8833 reported by rcourtna)

................
r51186 | qwell | 2007-01-17 11:36:53 -0600 (Wed, 17 Jan 2007) | 2 lines

re-add "password" for realtime voicemail

................
r51195 | tilghman | 2007-01-17 14:56:15 -0600 (Wed, 17 Jan 2007) | 12 lines

Merged revisions 51194 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51194 | tilghman | 2007-01-17 14:52:21 -0600 (Wed, 17 Jan 2007) | 4 lines

When ast_strip_quoted was called with a zero-length string, it would treat a
NULL as if it were the quoting character (and would thus return the string
in memory immediately following the passed-in string).

........

................
r51198 | russell | 2007-01-17 15:18:35 -0600 (Wed, 17 Jan 2007) | 11 lines

Merged revisions 51197 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51197 | russell | 2007-01-17 15:17:21 -0600 (Wed, 17 Jan 2007) | 3 lines

Move the check for a failure of ast_channel_alloc() to before locking the
pvt structure again.  Otherwise, on a failure, this will cause a deadlock.

........

................
r51204 | russell | 2007-01-17 16:09:52 -0600 (Wed, 17 Jan 2007) | 4 lines

Instead of dividing the offset by 2 directly, make it more clear that the
offset is being scaled by the size of the elements in the buffer.
(Inspired by a discussing on the asterisk-dev list about this code)

................
r51205 | russell | 2007-01-17 17:31:11 -0600 (Wed, 17 Jan 2007) | 5 lines

Fix some instances where when loading func_odbc, a double-free could occur.
Also, remove an unneeded error message.  If the failure condition is
actually a memory allocation failure, a log message will already be
generated automatically.

................
r51211 | file | 2007-01-17 18:18:44 -0600 (Wed, 17 Jan 2007) | 2 lines

Pass data as well for hold/unhold/vidupdate frames. (issue #8840 reported by mdu113)

................
r51213 | file | 2007-01-17 18:48:55 -0600 (Wed, 17 Jan 2007) | 2 lines

Build the IMAP remote directory string better and properly. Fix an issue with encoding the GSM voicemail when attaching to the voicemail. (issue #8808 reported by akohlsmith)

................
r51233 | russell | 2007-01-18 11:18:43 -0600 (Thu, 18 Jan 2007) | 3 lines

Make the "hasmanager" option in users.conf actually have an effect.
(issue #8740, LnxPrgr3)

................
r51236 | tilghman | 2007-01-18 11:49:41 -0600 (Thu, 18 Jan 2007) | 10 lines

Merged revisions 51235 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51235 | tilghman | 2007-01-18 11:42:17 -0600 (Thu, 18 Jan 2007) | 2 lines

Document all the fields, including the indication that "uniqueid" should not be renamed.

........

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

Added:
    team/russell/issue_8637/doc/voicemail_odbc_postgresql.txt
      - copied unchanged from r51236, branches/1.4/doc/voicemail_odbc_postgresql.txt
Modified:
    team/russell/issue_8637/   (props changed)
    team/russell/issue_8637/Makefile.rules
    team/russell/issue_8637/acinclude.m4
    team/russell/issue_8637/apps/app_voicemail.c
    team/russell/issue_8637/channels/chan_iax2.c
    team/russell/issue_8637/channels/chan_sip.c
    team/russell/issue_8637/channels/chan_zap.c
    team/russell/issue_8637/configs/users.conf.sample
    team/russell/issue_8637/configure
    team/russell/issue_8637/configure.ac
    team/russell/issue_8637/contrib/scripts/vmdb.sql
    team/russell/issue_8637/funcs/func_odbc.c
    team/russell/issue_8637/include/asterisk/autoconfig.h.in
    team/russell/issue_8637/main/Makefile
    team/russell/issue_8637/main/asterisk.c
    team/russell/issue_8637/main/config.c
    team/russell/issue_8637/main/file.c
    team/russell/issue_8637/main/manager.c
    team/russell/issue_8637/main/rtp.c
    team/russell/issue_8637/main/utils.c
    team/russell/issue_8637/makeopts.in
    team/russell/issue_8637/res/res_features.c

Propchange: team/russell/issue_8637/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/russell/issue_8637/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/russell/issue_8637/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 18 12:06:28 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-50843
+/branches/1.4:1-51238

Modified: team/russell/issue_8637/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/russell/issue_8637/Makefile.rules?view=diff&rev=51239&r1=51238&r2=51239
==============================================================================
--- team/russell/issue_8637/Makefile.rules (original)
+++ team/russell/issue_8637/Makefile.rules Thu Jan 18 12:06:28 2007
@@ -39,25 +39,25 @@
 %.o: %.c
 	$(ECHO_PREFIX) echo "   [CC] $< -> $@"
 ifeq ($(AST_DEVMODE),yes)
-	$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+	$(CMD_PREFIX) $(CC) -o $@ -c $< $(PTHREAD_CFLAGS) $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
 else
-	$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS)
+	$(CMD_PREFIX) $(CC) -o $@ -c $< $(PTHREAD_CFLAGS) $(ASTCFLAGS)
 endif
 
 %.o: %.s
 	$(ECHO_PREFIX) echo "   [AS] $< -> $@"
 ifeq ($(AST_DEVMODE),yes)
-	$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+	$(CMD_PREFIX) $(CC) -o $@ -c $< $(PTHREAD_CFLAGS) $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
 else
-	$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS)
+	$(CMD_PREFIX) $(CC) -o $@ -c $< $(PTHREAD_CFLAGS) $(ASTCFLAGS)
 endif
 
 %.oo: %.cc
 	$(ECHO_PREFIX) echo "   [CXX] $< -> $@"
 ifeq ($(AST_DEVMODE),yes)
-	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
+	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(PTHREAD_CFLAGS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations,$(ASTCFLAGS)) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
 else
-	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS)
+	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(PTHREAD_CFLAGS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations,$(ASTCFLAGS))
 endif
 
 %.c: %.y
@@ -70,12 +70,12 @@
 
 %.so: %.o
 	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
-	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLDFLAGS) $(SOLINK) $^ $(LIBS)
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) $^ $(PTHREAD_LIBS) $(LIBS)
 
 %.so: %.oo
 	$(ECHO_PREFIX) echo "   [LDXX] $^ -> $@"
-	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLDFLAGS) $(SOLINK) $^ $(LIBS)
+	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) $^ $(PTHREAD_LIBS) $(LIBS)
 
 %: %.o
 	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
-	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLDFLAGS) $^ $(LIBS)
+	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $^ $(PTHREAD_LIBS) $(LIBS)

Modified: team/russell/issue_8637/acinclude.m4
URL: http://svn.digium.com/view/asterisk/team/russell/issue_8637/acinclude.m4?view=diff&rev=51239&r1=51238&r2=51239
==============================================================================
--- team/russell/issue_8637/acinclude.m4 (original)
+++ team/russell/issue_8637/acinclude.m4 Thu Jan 18 12:06:28 2007
@@ -629,3 +629,245 @@
  rm -f conftest.sed
 ])# AST_PROG_SED
 
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl @summary figure out how to build C programs using POSIX threads
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl        LIBS="$PTHREAD_LIBS $LIBS"
+dnl        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl        CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <stevenj at alum.mit.edu>
+dnl @version 2006-05-29
+dnl @license GPLWithACException
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+#      ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+		pthread-config)
+		AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+		if test x"$acx_pthread_config" = xno; then continue; fi
+		PTHREAD_CFLAGS="`pthread-config --cflags`"
+		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+		;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [acx_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+	AC_MSG_CHECKING([for joinable pthread attribute])
+	attr_name=unknown
+	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+	    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+                        [attr_name=$attr; break])
+	done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with xlc_r or cc_r
+	if test x"$GCC" != xyes; then
+          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+        else
+          PTHREAD_CC=$CC
+	fi
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD

Modified: team/russell/issue_8637/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/issue_8637/apps/app_voicemail.c?view=diff&rev=51239&r1=51238&r2=51239
==============================================================================
--- team/russell/issue_8637/apps/app_voicemail.c (original)
+++ team/russell/issue_8637/apps/app_voicemail.c Thu Jan 18 12:06:28 2007
@@ -657,8 +657,11 @@
 	struct ast_variable *tmp;
 	tmp = var;
 	while (tmp) {
-		if (!strcasecmp(tmp->name, "password") || !strcasecmp(tmp->name, "secret")) {
+		if (!strcasecmp(tmp->name, "vmpassword")) {
 			ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
+		} else if (!strcasecmp(tmp->name, "secret") || !strcasecmp(tmp->name, "password")) { /* don't overwrite vmpassword if it exists */
+			if (ast_strlen_zero(retval->password))
+				ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
 		} else if (!strcasecmp(tmp->name, "uniqueid")) {
 			ast_copy_string(retval->uniqueid, tmp->value, sizeof(retval->uniqueid));
 		} else if (!strcasecmp(tmp->name, "pager")) {
@@ -669,6 +672,12 @@
 			ast_copy_string(retval->fullname, tmp->value, sizeof(retval->fullname));
 		} else if (!strcasecmp(tmp->name, "context")) {
 			ast_copy_string(retval->context, tmp->value, sizeof(retval->context));
+#ifdef IMAP_STORAGE
+		} else if (!strcasecmp(tmp->name, "imapuser")) {
+			ast_copy_string(retval->imapuser, tmp->value, sizeof(retval->imapuser));
+		} else if (!strcasecmp(tmp->name, "imappassword")) {
+			ast_copy_string(retval->imappassword, tmp->value, sizeof(retval->imappassword));
+#endif
 		} else
 			apply_option(retval, tmp->name, tmp->value);
 		tmp = tmp->next;
@@ -753,134 +762,77 @@
 
 static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
 {
-	/*  There's probably a better way of doing this. */
-	/*  That's why I've put the password change in a separate function. */
-	/*  This could also be done with a database function */
-	
-	FILE *configin;
-	FILE *configout;
-	int linenum=0;
-	char inbuf[256];
-	char orig[256];
-	char currcontext[256] = "";
-	char tmpin[PATH_MAX];
-	char tmpout[PATH_MAX];
-	struct stat statbuf;
-
+	struct ast_config   *cfg=NULL;
+	struct ast_variable *var=NULL;
+	struct ast_category *cat=NULL;
+	char *category=NULL, *value=NULL, *new=NULL;
+	const char *tmp=NULL;
+					
 	if (!change_password_realtime(vmu, newpassword))
 		return;
 
-	snprintf(tmpin, sizeof(tmpin), "%s/voicemail.conf", ast_config_AST_CONFIG_DIR);
-	snprintf(tmpout, sizeof(tmpout), "%s/voicemail.conf.new", ast_config_AST_CONFIG_DIR);
-	configin = fopen(tmpin,"r");
-	if (configin)
-		configout = fopen(tmpout,"w+");
-	else
-		configout = NULL;
-	if (!configin || !configout) {
-		if (configin)
-			fclose(configin);
-		else
-			ast_log(LOG_WARNING, "Warning: Unable to open '%s' for reading: %s\n", tmpin, strerror(errno));
-		if (configout)
-			fclose(configout);
-		else
-			ast_log(LOG_WARNING, "Warning: Unable to open '%s' for writing: %s\n", tmpout, strerror(errno));
-			return;
-	}
-
-	while (!feof(configin)) {
-		char *user = NULL, *pass = NULL, *rest = NULL, *comment = NULL, *tmpctx = NULL, *tmpctxend = NULL;
-
-		/* Read in the line */
-		if (fgets(inbuf, sizeof(inbuf), configin) == NULL)
-			continue;
-		linenum++;
-
-		/* Make a backup of it */
-		ast_copy_string(orig, inbuf, sizeof(orig));
-
-		/*
-		  Read the file line by line, split each line into a comment and command section
-		  only parse the command portion of the line
-		*/
-		if (inbuf[strlen(inbuf) - 1] == '\n')
-			inbuf[strlen(inbuf) - 1] = '\0';
-
-		if ((comment = strchr(inbuf, ';')))
-			*comment++ = '\0'; /* Now inbuf is terminated just before the comment */
-
-		if (ast_strlen_zero(inbuf)) {
-			fprintf(configout, "%s", orig);
-			continue;
-		}
-
-		/* Check for a context, first '[' to first ']' */
-		if ((tmpctx = strchr(inbuf, '['))) {
-			tmpctxend = strchr(tmpctx, ']');
-			if (tmpctxend) {
-				/* Valid context */
-				ast_copy_string(currcontext, tmpctx + 1, tmpctxend - tmpctx);
-				fprintf(configout, "%s", orig);
-				continue;
-			}
-		}
-
-		/* This isn't a context line, check for MBX => PSWD... */
-		user = inbuf;
-		if ((pass = strchr(user, '='))) {
-			/* We have a line in the form of aaaaa=aaaaaa */
-			*pass++ = '\0';
-
-			user = ast_strip(user);
-
-			if (*pass == '>')
-				*pass++ = '\0';
-
-			pass = ast_skip_blanks(pass);
-
-			/* 
-			   Since no whitespace allowed in fields, or more correctly white space
-			   inside the fields is there for a purpose, we can just terminate pass
-			   at the comma or EOL whichever comes first.
-			*/
-			if ((rest = strchr(pass, ',')))
-				*rest++ = '\0';
-		} else {
-			user = NULL;
-		}			
-
-		/* Compare user, pass AND context */
-		if (!ast_strlen_zero(user) && !strcmp(user, vmu->mailbox) &&
-			!ast_strlen_zero(pass) && !strcmp(pass, vmu->password) &&
-			!strcasecmp(currcontext, vmu->context)) {
-			/* This is the line */
-			if (rest) {
-				fprintf(configout, "%s => %s,%s", user, newpassword, rest);
-			} else {
-				fprintf(configout, "%s => %s", user, newpassword);
-			}
-			/* If there was a comment on the line print it out */
-			if (comment) {
-				fprintf(configout, ";%s\n", comment);
-			} else {
-				fprintf(configout, "\n");
-			}
-		} else {
-			/* Put it back like it was */
-			fprintf(configout, "%s", orig);
-		}
-	}
-	fclose(configin);
-	fclose(configout);
-
-	stat(tmpin, &statbuf);
-	chmod(tmpout, statbuf.st_mode);
-	chown(tmpout, statbuf.st_uid, statbuf.st_gid);
-	unlink(tmpin);
-	rename(tmpout, tmpin);
-	reset_user_pw(vmu->context, vmu->mailbox, newpassword);
-	ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
+	/* check voicemail.conf */
+	if ((cfg = ast_config_load_with_comments(VOICEMAIL_CONFIG))) {
+		while ((category = ast_category_browse(cfg, category))) {
+			if (!strcasecmp(category, vmu->context)) {
+				tmp = ast_variable_retrieve(cfg, category, vmu->mailbox);
+				if (!tmp) {
+					ast_log(LOG_WARNING, "We could not find the mailbox.\n");
+					break;
+				}
+				value = strstr(tmp,",");
+				if (!value) {
+					ast_log(LOG_WARNING, "variable has bad format.\n");
+					break;
+				}
+				new = alloca((strlen(value)+strlen(newpassword)+1));
+				sprintf(new,"%s%s", newpassword, value);
+				if (!(cat = ast_category_get(cfg, category))) {
+					ast_log(LOG_WARNING, "Failed to get category structure.\n");
+					break;
+				}
+				ast_variable_update(cat, vmu->mailbox, new, NULL);
+			}
+		}
+		/* save the results */
+		reset_user_pw(vmu->context, vmu->mailbox, newpassword);
+		ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
+		config_text_file_save(VOICEMAIL_CONFIG, cfg, "AppVoicemail");
+	}
+	category = NULL;
+	var = NULL;
+	/* check users.conf and update the password stored for the mailbox*/
+	/* if no vmpassword entry exists create one. */
+	if ((cfg = ast_config_load_with_comments("users.conf"))) {
+		if (option_debug > 3)
+			ast_log(LOG_DEBUG, "we are looking for %s\n", vmu->mailbox);
+		while ((category = ast_category_browse(cfg, category))) {
+			if (option_debug > 3)
+				ast_log(LOG_DEBUG, "users.conf: %s\n", category);
+			if (!strcasecmp(category, vmu->mailbox)) {
+				if (!(tmp = ast_variable_retrieve(cfg, category, "vmpassword"))) {
+					if (option_debug > 3)
+						ast_log(LOG_DEBUG, "looks like we need to make vmpassword!\n");
+					var = ast_variable_new("vmpassword", newpassword);
+				} 
+				new = alloca(strlen(newpassword)+1);
+				sprintf(new, "%s", newpassword);
+				if (!(cat = ast_category_get(cfg, category))) {
+					if (option_debug > 3)
+						ast_log(LOG_DEBUG, "failed to get category!\n");
+					break;
+				}
+				if (!var)		
+					ast_variable_update(cat, "vmpassword", new, NULL);
+				else
+					ast_variable_append(cat, var);
+			}
+		}
+		/* save the results and clean things up */
+		reset_user_pw(vmu->context, vmu->mailbox, newpassword);	
+		ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
+		config_text_file_save("users.conf", cfg, "AppVoicemail");
+	}
 }
 
 static void vm_change_password_shell(struct ast_vm_user *vmu, char *newpassword)
@@ -1095,7 +1047,7 @@
 			}
 			if (!strcasecmp(coltitle, "recording")) {
 				off_t offset;
-				res = SQLGetData(stmt, x + 1, SQL_BINARY, NULL, 0, &colsize2);
+				res = SQLGetData(stmt, x + 1, SQL_BINARY, rowdata, 0, &colsize2);
 				fdlen = colsize2;
 				if (fd > -1) {
 					char tmp[1]="";
@@ -1107,15 +1059,14 @@
 					}
 					/* Read out in small chunks */
 					for (offset = 0; offset < colsize2; offset += CHUNKSIZE) {
-						/* +1 because SQLGetData likes null-terminating binary data */
-						if ((fdm = mmap(NULL, CHUNKSIZE + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
+						if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
 							ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
 							SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 							ast_odbc_release_obj(obj);
 							goto yuck;
 						} else {
-							res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE + 1, NULL);
-							munmap(fdm, 0);
+							res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE, NULL);
+							munmap(fdm, CHUNKSIZE);
 							if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 								ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
 								unlink(full_fn);
@@ -2020,7 +1971,7 @@
 		snprintf(fname, sizeof(fname), "%s.%s", attach, format);
 		base_encode(fname, p);
 		/* only attach if necessary */
-		if (imap && strcmp(format, "gsm")) {
+		if (imap && !strcmp(format, "gsm")) {
 			fprintf(p, "--%s\r\n", bound);
 			fprintf(p, "Content-Type: audio/x-gsm; name=\"msg%04d.%s\"\r\n", msgnum, format);
 			fprintf(p, "Content-Transfer-Encoding: base64\r\n");
@@ -2646,7 +2597,7 @@
 #endif
 #ifndef IMAP_STORAGE
 /* copy message only used by file storage */
-static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt)
+static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt, char *dir)
 {
 	char fromdir[PATH_MAX], todir[PATH_MAX], frompath[PATH_MAX], topath[PATH_MAX];
 	const char *frombox = mbox(imbox);
@@ -2655,8 +2606,12 @@
 	ast_log(LOG_NOTICE, "Copying message from %s@%s to %s@%s\n", vmu->mailbox, vmu->context, recip->mailbox, recip->context);
 
 	create_dirpath(todir, sizeof(todir), recip->context, recip->mailbox, "INBOX");
-
-	make_dir(fromdir, sizeof(fromdir), vmu->context, vmu->mailbox, frombox);
+	
+	if (!dir)
+		make_dir(fromdir, sizeof(fromdir), vmu->context, vmu->mailbox, frombox);
+	else
+		ast_copy_string(fromdir, dir, sizeof(fromdir));
+
 	make_file(frompath, sizeof(frompath), fromdir, msgnum);
 
 	if (vm_lock_path(todir))
@@ -3162,7 +3117,7 @@
 							context++;
 						}
 						if ((recip = find_user(&recipu, context, exten))) {
-							copy_message(chan, vmu, 0, msgnum, duration, recip, fmt);
+							copy_message(chan, vmu, 0, msgnum, duration, recip, fmt, dir);
 							free_user(recip);
 						}
 					}
@@ -4162,7 +4117,7 @@
 				/* NULL category for IMAP storage */
 				sendmail(myserveremail, vmtmp, todircount, vmtmp->context, vmtmp->mailbox, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL), vms->fn, fmt, duration, attach_user_voicemail, chan, NULL);
 #else
-				copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt);
+				copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt, dir);
 #endif
 				saved_messages++;
 				AST_LIST_REMOVE_CURRENT(&extensions, list);
@@ -4614,8 +4569,9 @@
 #ifdef IMAP_STORAGE
 static void imap_mailbox_name(char *spec, struct vm_state *vms, int box, int use_folder)
 {
-	char tmp[256];
-	
+	char tmp[256], *t = tmp;
+	size_t left = sizeof(tmp);
+
 	if (box == 1) {
 		ast_copy_string(vms->curbox, mbox(0), sizeof(vms->curbox));
 		sprintf(vms->vmbox, "vm-%s", mbox(1));
@@ -4624,11 +4580,20 @@
 		snprintf(vms->vmbox, sizeof(vms->vmbox), "vm-%s", vms->curbox);
 	}
 
-	if (strlen(authuser) > 0) {
-		snprintf(tmp, sizeof(tmp), "{%s:%s/imap/authuser=%s/%s/user=%s}",imapserver,imapport,authuser,imapflags,vms->imapuser);
-	} else {
-		snprintf(tmp, sizeof(tmp), "{%s:%s/imap/%s/user=%s}",imapserver,imapport,imapflags,vms->imapuser);
-	}
+	/* Build up server information */
+	ast_build_string(&t, &left, "{%s:%s/imap", imapserver, imapport);
+
+	/* Add authentication user if present */
+	if (!ast_strlen_zero(authuser))
+		ast_build_string(&t, &left, "/%s", authuser);
+
+	/* Add flags if present */
+	if (!ast_strlen_zero(imapflags))
+		ast_build_string(&t, &left, "/%s", imapflags);
+
+	/* End with username */
+	ast_build_string(&t, &left, "/user=%s}", vms->imapuser);
+
 	if(box == 0 || box == 1)
 		sprintf(spec, "%s%s", tmp, use_folder? imapfolder: "INBOX");
 	else
@@ -6446,6 +6411,7 @@
 						cmd = forward_message(chan, context, &vms, vmu, vmfmts, 1, record_gain);
 						if (cmd == ERROR_LOCK_PATH) {
 							res = cmd;
+							ast_log(LOG_WARNING, "forward_message failed to lock path.\n");
 							goto out;
 						}
 					} else
@@ -8278,6 +8244,28 @@
 }
 #endif
 
+static struct ast_vm_user *find_user_realtime_imapuser(const char *imapuser)
+{
+	struct ast_variable *var;
+	struct ast_vm_user *vmu;
+
+	vmu = ast_calloc(1, sizeof *vmu);
+	if (!vmu)
+		return NULL;
+	ast_set_flag(vmu, VM_ALLOCED);
+	populate_defaults(vmu);
+
+	var = ast_load_realtime("voicemail", "imapuser", imapuser, NULL);
+	if (var) {
+		apply_options_full(vmu, var);
+		ast_variables_destroy(var);
+		return vmu;
+	} else {
+		free(vmu);
+		return NULL;
+	}
+}
+
 /* Interfaces to C-client */
 
 void mm_exists(MAILSTREAM * stream, unsigned long number)
@@ -8411,6 +8399,12 @@
 			if(!strcasecmp(mb->user, vmu->imapuser)) {
 				ast_copy_string(pwd, vmu->imappassword, MAILTMPLEN);
 				break;
+			}
+		}
+		if (!vmu) {
+			if ((vmu = find_user_realtime_imapuser(mb->user))) {
+				ast_copy_string(pwd, vmu->imappassword, MAILTMPLEN);
+				free_user(vmu);
 			}
 		}
 	}

Modified: team/russell/issue_8637/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/issue_8637/channels/chan_iax2.c?view=diff&rev=51239&r1=51238&r2=51239
==============================================================================
--- team/russell/issue_8637/channels/chan_iax2.c (original)
+++ team/russell/issue_8637/channels/chan_iax2.c Thu Jan 18 12:06:28 2007
@@ -908,26 +908,25 @@
 #define schedule_action(func, data) __schedule_action(func, data, __PRETTY_FUNCTION__)
 #endif
 
+static int send_ping(void *data);
+
 static void __send_ping(void *data)
 {
 	int callno = (long)data;
 	ast_mutex_lock(&iaxsl[callno]);
-	if (iaxs[callno])
+	if (iaxs[callno] && iaxs[callno]->pingid != -1) {
 		send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
+		iaxs[callno]->pingid = ast_sched_add(sched, ping_time * 1000, send_ping, data);
+	}
 	ast_mutex_unlock(&iaxsl[callno]);
 }
 
 static int send_ping(void *data)
 {
-	int callno = (long)data;
-	if (iaxs[callno]) {
 #ifdef SCHED_MULTITHREADED
-		if (schedule_action(__send_ping, data))
+	if (schedule_action(__send_ping, data))
 #endif		
-			__send_ping(data);
-		return 1;
-	} else
-		return 0;
+		__send_ping(data);
 	return 0;
 }
 
@@ -943,27 +942,26 @@
 	return e;
 }
 
+static int send_lagrq(void *data);
+
 static void __send_lagrq(void *data)
 {
 	int callno = (long)data;
 	/* Ping only if it's real not if it's bridged */
 	ast_mutex_lock(&iaxsl[callno]);
-	if (iaxs[callno])
+	if (iaxs[callno] && iaxs[callno]->lagid != -1) {
 		send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_LAGRQ, 0, NULL, 0, -1);
+		iaxs[callno]->lagid = ast_sched_add(sched, lagrq_time * 1000, send_lagrq, data);
+	}
 	ast_mutex_unlock(&iaxsl[callno]);
 }
 
 static int send_lagrq(void *data)
 {
-	int callno = (long)data;
-	if (iaxs[callno]) {
 #ifdef SCHED_MULTITHREADED
-		if (schedule_action(__send_lagrq, data))
+	if (schedule_action(__send_lagrq, data))
 #endif		
-			__send_lagrq(data);
-		return 1;
-	} else
-		return 0;
+		__send_lagrq(data);
 	return 0;
 }
 

Modified: team/russell/issue_8637/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/issue_8637/channels/chan_sip.c?view=diff&rev=51239&r1=51238&r2=51239
==============================================================================
--- team/russell/issue_8637/channels/chan_sip.c (original)
+++ team/russell/issue_8637/channels/chan_sip.c Thu Jan 18 12:06:28 2007
@@ -3735,11 +3735,11 @@
 		tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "SIP/%s-%08x", my_name, (int)(long) i);
 
 	}
-	ast_mutex_lock(&i->lock);
 	if (!tmp) {
 		ast_log(LOG_WARNING, "Unable to allocate AST channel structure for SIP channel\n");
 		return NULL;
 	}
+	ast_mutex_lock(&i->lock);
 	tmp->tech = &sip_tech;
 
 	/* Select our native format based on codec preference until we receive

Modified: team/russell/issue_8637/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/russell/issue_8637/channels/chan_zap.c?view=diff&rev=51239&r1=51238&r2=51239
==============================================================================
--- team/russell/issue_8637/channels/chan_zap.c (original)
+++ team/russell/issue_8637/channels/chan_zap.c Thu Jan 18 12:06:28 2007
@@ -4774,7 +4774,7 @@

[... 1289 lines stripped ...]


More information about the asterisk-commits mailing list