[svn-commits] wedhorn: branch wedhorn/readq-locking r201822 - in /team/wedhorn/readq-lockin...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 18 17:21:54 CDT 2009


Author: wedhorn
Date: Thu Jun 18 17:21:45 2009
New Revision: 201822

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=201822
Log:
Merged revisions 201056,201090,201135,201137,201139,201190,201223,201262,201331,201344,201381,201445,201453,201458,201462,201531,201534,201570,201583,201610,201678,201717,201745,201783 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r201056 | kpfleming | 2009-06-17 04:54:30 +1000 (Wed, 17 Jun 2009) | 18 lines
  
  Merged revisions 200991 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r200991 | kpfleming | 2009-06-16 12:05:38 -0500 (Tue, 16 Jun 2009) | 11 lines
    
    Improve support for media paths that can generate multiple frames at once.
    
    There are various media paths in Asterisk (codec translators and UDPTL, primarily)
    that can generate more than one frame to be generated when the application calling
    them expects only a single frame. This patch addresses a number of those cases,
    at least the primary ones to solve the known problems. In addition it removes the
    broken TRACE_FRAMES support, fixes a number of bugs in various frame-related API
    functions, and cleans up various code paths affected by these changes.
    
    https://reviewboard.asterisk.org/r/175/
  ........
................
  r201090 | kpfleming | 2009-06-17 05:27:12 +1000 (Wed, 17 Jun 2009) | 5 lines
  
  Another minor fix to compiler attribute checking.
  
  Defaulting to 'static' for the function scope was bad... so remove it.
................
  r201135 | kpfleming | 2009-06-17 06:50:41 +1000 (Wed, 17 Jun 2009) | 7 lines
  
  When compiling in an Emacs-spawned shell, always print directory names.
  
  This change ensures that Emacs can find the proper source files when parsing
  compiler error messages, since it uses the 'make' output including directory
  names to do it.
................
  r201137 | kpfleming | 2009-06-17 07:02:05 +1000 (Wed, 17 Jun 2009) | 6 lines
  
  Explicitly test for 'static weakref' support.
  
  Since we use 'static' weakref symbols, and not all GCC versions support them,
  test for that combination explicitly.
................
  r201139 | kpfleming | 2009-06-17 07:10:15 +1000 (Wed, 17 Jun 2009) | 10 lines
  
  Enable applications to enable/disable digit and tone detection.
  
  Some applications (notably app_fax) do not need digit detection nor FAX tone
  detection while they are running, and if Asterisk is using software DSPs to provide
  the detection, this consumes extra CPU cycles that could be better spent on the
  actual application. This patch allows applications to query and control the state
  of digit and tone detection on a channel, and modifies app_fax to disable them
  while the FAX operations are occurring (and re-enable digit detection afterwards).
................
  r201190 | seanbright | 2009-06-17 08:11:07 +1000 (Wed, 17 Jun 2009) | 2 lines
  
  Update my e-mail address (thanks for the props, russell :))
................
  r201223 | dvossel | 2009-06-17 08:29:30 +1000 (Wed, 17 Jun 2009) | 2 lines
  
  fix issue with build_contact introduced by the "SIP trasnport type issues" commit
................
  r201262 | kpfleming | 2009-06-17 22:04:17 +1000 (Wed, 17 Jun 2009) | 15 lines
  
  Merged revisions 201261 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r201261 | kpfleming | 2009-06-17 07:03:25 -0500 (Wed, 17 Jun 2009) | 9 lines
    
    Correct AST_LIST_APPEND_LIST behavior when list to be appended is empty.
    
    When the list to be appended is empty, and the list to be appended to is *not*,
    AST_LIST_APPEND_LIST would actually cause the target list to become broken,
    and no longer have a pointer to its last entry. This patch fixes the problem.
    
    (reported by Stanislaw Pitucha on the asterisk-dev mailing list)
  ........
................
  r201331 | dvossel | 2009-06-18 00:42:06 +1000 (Thu, 18 Jun 2009) | 7 lines
  
  update chan_iax to use 64bit feature flags.
  
  (closes issue #15335)
  Reported by: lmadsen
  
  Review: https://reviewboard.asterisk.org/r/284/
................
  r201344 | dvossel | 2009-06-18 01:20:26 +1000 (Thu, 18 Jun 2009) | 16 lines
  
  SIP registry ref count error
  
  During a sip reload, the list of sip_registry objects are
  supposed to be traversed, unlinked, and destroyed, but
  destruction never takes place due to a ref counting error.
  This causes a memory leak when registry items are removed
  from sip.conf and reloaded.  While the registries are removed
  from the global list, they are not removed from the scheduler.
  Because of this, SIP register attempts continue to be sent
  out for the item even though it may no longer be in the .conf.
  
  (closes issue #15295)
  Reported by: amorsen
  
  Review: https://reviewboard.asterisk.org/r/282/
................
  r201381 | dbrooks | 2009-06-18 05:15:07 +1000 (Thu, 18 Jun 2009) | 16 lines
  
  Merged revisions 201380 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r201380 | dbrooks | 2009-06-17 13:45:50 -0500 (Wed, 17 Jun 2009) | 9 lines
    
    Checks for NULL sip_pvt pointer in chan_sip.c->acf_channel_read()
    
    Zombie channels could be passed, and chan_sip.c wasn't checking for it.
    Could crash Asterisk. Now checking for NULL pointer.
    
    (closes issue #15330)
    Reported by: okrief
    Tested by: dbrooks
  ........
................
  r201445 | dvossel | 2009-06-18 05:45:35 +1000 (Thu, 18 Jun 2009) | 25 lines
  
  Merged revisions 201423 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r201423 | dvossel | 2009-06-17 14:28:12 -0500 (Wed, 17 Jun 2009) | 19 lines
    
    StopMixMonitor race condition (not giving up file immediately)
    
    StopMixMonitor only indicates to the MixMonitor thread to stop
    writing to the file.  It does not guarantee that the recording's
    file handle is available to the dialplan immediately after execution.
    This results in a race condition.  To resolve this, the filestream
    pointer is placed in a datastore on the channel. When StopMixMonitor
    is called, the datastore is retrieved from the channel and the
    filestream is closed immediately before returning to the dialplan.
    Documentation indicating the use of StopMixMonitor to free files
    has been updated as well.
    
    (closes issue #15259)
    Reported by: travisghansen
    Tested by: dvossel
    
    Review: https://reviewboard.asterisk.org/r/283/
  ........
................
  r201453 | dvossel | 2009-06-18 06:00:51 +1000 (Thu, 18 Jun 2009) | 3 lines
  
  ast_channel_datastore_alloc is no longer used. updating datastores.txt to reflect that.
................
  r201458 | mmichelson | 2009-06-18 06:04:12 +1000 (Thu, 18 Jun 2009) | 15 lines
  
  Merged revisions 201450 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r201450 | mmichelson | 2009-06-17 14:59:31 -0500 (Wed, 17 Jun 2009) | 9 lines
    
    Change the datastore traversal in ast_do_masquerade to use a safe list traversal.
    
    It is possible for datastore fixup functions to remove the datastore from the list
    and free it. In particular, the queue_transfer_fixup in app_queue does this. While
    I don't yet know of this causing any crashes, it certainly could.
    
    Found while discussing a separate issue with Brian Degenhardt.
  ........
................
  r201462 | mmichelson | 2009-06-18 06:10:01 +1000 (Thu, 18 Jun 2009) | 12 lines
  
  Fix problem with no audio due to ignoring the SDP.
  
  A recent change to our SDP version comparison made audio not function
  on some calls. This was because of a test wherein we were trying to
  see if an unsigned value was less than 0. This is a dumb comparison
  and arguably the compiler should have warned about it. Alas, though,
  it slipped past. Now it's fixed by changing the variable to be a
  signed type.
  
  Found by several developers. Tested by mnicholson and dbrooks.
................
  r201531 | tilghman | 2009-06-18 07:31:39 +1000 (Thu, 18 Jun 2009) | 7 lines
  
  Initialize additional variables, to prevent a possible crash.
  (closes issue #15186)
   Reported by: ajohnson
   Patches: 
         20090528__issue15186.diff.txt uploaded by tilghman (license 14)
   Tested by: ajohnson
................
  r201534 | dvossel | 2009-06-18 07:56:42 +1000 (Thu, 18 Jun 2009) | 11 lines
  
  Add rtsavesysname to chan_iax
  
  chan_sip has an option to save the sysname on rtupdate.  This patch copies that same logic to chan_iax.
  
  (closes issue #14837)
  Reported by: barthpbx
  Patches:
        iax2-rtsavesysname.patch uploaded by barthpbx (license 744)
        rt_iax.diff uploaded by dvossel (license 671)
................
  r201570 | dvossel | 2009-06-19 01:16:05 +1000 (Fri, 19 Jun 2009) | 11 lines
  
  parsing extension correctly from sip register lines
  
  If a transport type was specified, but no extension, parsing of the extension would return whatever was after the transport rather than defaulting to 's'.
  
  (closes issue #15111)
  Reported by: ffs
  Patches:
        chan_sip.c_register-parser.patch uploaded by ffs (license 730)
  Tested by: ffs, dvossel
................
  r201583 | mmichelson | 2009-06-19 01:20:17 +1000 (Fri, 19 Jun 2009) | 9 lines
  
  Trunk implementation of setting an alternate RTP source.
  
  This contains the interface by which we can let an rtp instance know
  that it might start receiving audio from a new source. This is similar
  in nature to revision 197588 of Asterisk 1.4.
  
  Review: https://reviewboard.asterisk.org/r/276
................
  r201610 | russell | 2009-06-19 01:27:10 +1000 (Fri, 19 Jun 2009) | 36 lines
  
  Merged revisions 201600 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r201600 | russell | 2009-06-18 10:24:31 -0500 (Thu, 18 Jun 2009) | 29 lines
    
    Fix memory corruption and leakage related reloads of non files mode MoH classes.
    
    For Music on Hold classes that are not files mode, meaning that we are executing
    an application that will feed us audio data, we use a thread to monitor the
    external application and read audio from it.  This thread also makes use of the
    MoH class object.  In the MoH class destructor, we used pthread_cancel() to ask
    the thread to exit.  Unfortunately, the code did not wait to ensure that the
    thread actually went away.  What needed to be done is a pthread_join() to ensure
    that the thread fully cleans up before we proceed.  By adding this one line, we
    resolve two significant problems:
    
      1) Since the thread was never joined, it never fully goes away.  So, on every
         reload of non-files mode MoH, an unused thread was sticking around.
    
      2) There was a race condition here where the application monitoring thread
         could still try to access the MoH class, even though the thread executing
         the MoH reload has already destroyed it.
    
    (issue #15109)
    Reported by: jvandal
    
    (issue #15123)
    Reported by: axisinternet
    
    (issue #15195)
    Reported by: amorsen
    
    (issue AST-208)
  ........
................
  r201678 | dvossel | 2009-06-19 02:37:42 +1000 (Fri, 19 Jun 2009) | 11 lines
  
  fixes some memory leaks and redundant conditions
  
  (closes issue #15269)
  Reported by: contactmayankjain
  Patches:
        patch.txt uploaded by contactmayankjain (license 740)
        memory_leak_stuff.trunk.diff uploaded by dvossel (license 671)
  Tested by: contactmayankjain, dvossel
................
  r201717 | mnicholson | 2009-06-19 03:41:09 +1000 (Fri, 19 Jun 2009) | 4 lines
  
  Added deadlock protection to try_suggested_sip_codec in chan_sip.c.
  
  Review: https://reviewboard.asterisk.org/r/285/
................
  r201745 | tilghman | 2009-06-19 04:24:23 +1000 (Fri, 19 Jun 2009) | 7 lines
  
  Clarify CUT code, and in the process, fix a bug in trunk only
  (closes issue #15320)
   Reported by: chappell
   Patches: 
         cut_fix.patch uploaded by chappell (license 8)
         cut_clarify.patch uploaded by chappell (license 8)
................
  r201783 | tilghman | 2009-06-19 06:52:36 +1000 (Fri, 19 Jun 2009) | 6 lines
  
  One of the changes in 1.6.1 was to allow app_directory to use functionality
  within app_voicemail for directory functions.  It is therefore no longer
  necessary for app_directory to be linked against the ODBC libraries (and it
  never was necessary for app_directory to be linked against IMAP, though it
  was).
................

Modified:
    team/wedhorn/readq-locking/   (props changed)
    team/wedhorn/readq-locking/CHANGES
    team/wedhorn/readq-locking/CREDITS
    team/wedhorn/readq-locking/Makefile
    team/wedhorn/readq-locking/apps/Makefile
    team/wedhorn/readq-locking/apps/app_chanspy.c
    team/wedhorn/readq-locking/apps/app_fax.c
    team/wedhorn/readq-locking/apps/app_meetme.c
    team/wedhorn/readq-locking/apps/app_mixmonitor.c
    team/wedhorn/readq-locking/apps/app_rpt.c
    team/wedhorn/readq-locking/apps/app_voicemail.c
    team/wedhorn/readq-locking/autoconf/ast_gcc_attribute.m4
    team/wedhorn/readq-locking/channels/chan_dahdi.c
    team/wedhorn/readq-locking/channels/chan_iax2.c
    team/wedhorn/readq-locking/channels/chan_sip.c
    team/wedhorn/readq-locking/channels/h323/ast_h323.cxx
    team/wedhorn/readq-locking/channels/misdn/isdn_lib.c
    team/wedhorn/readq-locking/channels/xpmr/xpmr.c
    team/wedhorn/readq-locking/codecs/gsm/src/gsm_destroy.c
    team/wedhorn/readq-locking/configs/iax.conf.sample
    team/wedhorn/readq-locking/configure
    team/wedhorn/readq-locking/configure.ac
    team/wedhorn/readq-locking/doc/datastores.txt
    team/wedhorn/readq-locking/funcs/func_cut.c
    team/wedhorn/readq-locking/include/asterisk/channel.h
    team/wedhorn/readq-locking/include/asterisk/frame.h
    team/wedhorn/readq-locking/include/asterisk/linkedlists.h
    team/wedhorn/readq-locking/include/asterisk/rtp_engine.h
    team/wedhorn/readq-locking/main/ast_expr2.c
    team/wedhorn/readq-locking/main/ast_expr2f.c
    team/wedhorn/readq-locking/main/asterisk.c
    team/wedhorn/readq-locking/main/autoservice.c
    team/wedhorn/readq-locking/main/channel.c
    team/wedhorn/readq-locking/main/file.c
    team/wedhorn/readq-locking/main/frame.c
    team/wedhorn/readq-locking/main/rtp_engine.c
    team/wedhorn/readq-locking/main/slinfactory.c
    team/wedhorn/readq-locking/pbx/pbx_config.c
    team/wedhorn/readq-locking/res/ael/ael_lex.c
    team/wedhorn/readq-locking/res/res_config_ldap.c
    team/wedhorn/readq-locking/res/res_musiconhold.c
    team/wedhorn/readq-locking/res/res_rtp_asterisk.c
    team/wedhorn/readq-locking/utils/ael_main.c
    team/wedhorn/readq-locking/utils/conf2ael.c
    team/wedhorn/readq-locking/utils/extconf.c
    team/wedhorn/readq-locking/utils/stereorize.c

Propchange: team/wedhorn/readq-locking/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/wedhorn/readq-locking/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/wedhorn/readq-locking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jun 18 17:21:45 2009
@@ -1,1 +1,1 @@
-/trunk:1-201054
+/trunk:1-201796

Modified: team/wedhorn/readq-locking/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/CHANGES?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/CHANGES (original)
+++ team/wedhorn/readq-locking/CHANGES Thu Jun 18 17:21:45 2009
@@ -33,6 +33,11 @@
    will accept the SDP even if the SDP version number is not properly incremented,
    but will generate a warning in the log indicating that the SIP peer that sent
    the SDP should have the 'ignoresdpversion' option set.
+
+IAX2 Changes
+-----------
+ * Added rtsavesysname option into iax.conf to allow the systname to be saved
+   on realtime updates.
 
 Applications
 ------------

Modified: team/wedhorn/readq-locking/CREDITS
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/CREDITS?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/CREDITS (original)
+++ team/wedhorn/readq-locking/CREDITS Thu Jun 18 17:21:45 2009
@@ -202,7 +202,7 @@
 
 Sean Bright - Snom call pickup, newt interface for menuselect, cdr_tds rewrite,
 	countless other improvements, fixes, and good ideas.
-	sean.bright(AT)gmail.com
+	sean(AT)malleable.com
 
 === OTHER CONTRIBUTIONS ===
 John Todd - Monkey sounds and associated teletorture prompt

Modified: team/wedhorn/readq-locking/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/Makefile?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/Makefile (original)
+++ team/wedhorn/readq-locking/Makefile Thu Jun 18 17:21:45 2009
@@ -326,6 +326,10 @@
 
 # comment to print directories during submakes
 #PRINT_DIR=yes
+
+ifneq ($(INSIDE_EMACS),)
+PRINT_DIR=yes
+endif
 
 SILENTMAKE:=$(MAKE) --quiet --no-print-directory
 ifneq ($(PRINT_DIR)$(NOISY_BUILD),)

Modified: team/wedhorn/readq-locking/apps/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/apps/Makefile?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/apps/Makefile (original)
+++ team/wedhorn/readq-locking/apps/Makefile Thu Jun 18 17:21:45 2009
@@ -18,11 +18,9 @@
 MENUSELECT_OPTS_app_directory:=$(MENUSELECT_OPTS_app_voicemail)
 ifneq ($(findstring ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
   MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_ODBC_STORAGE)
-  MENUSELECT_DEPENDS_app_directory+=$(MENUSELECT_DEPENDS_ODBC_STORAGE)
 endif
 ifneq ($(findstring IMAP_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
   MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_IMAP_STORAGE)
-  MENUSELECT_DEPENDS_app_directory+=$(MENUSELECT_DEPENDS_IMAP_STORAGE)
 endif
 
 all: _all

Modified: team/wedhorn/readq-locking/apps/app_chanspy.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/apps/app_chanspy.c?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/apps/app_chanspy.c (original)
+++ team/wedhorn/readq-locking/apps/app_chanspy.c Thu Jun 18 17:21:45 2009
@@ -410,7 +410,7 @@
 static int spy_generate(struct ast_channel *chan, void *data, int len, int samples)
 {
 	struct chanspy_translation_helper *csth = data;
-	struct ast_frame *f = NULL;
+	struct ast_frame *f, *cur;
 
 	ast_audiohook_lock(&csth->spy_audiohook);
 	if (csth->spy_audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING) {
@@ -426,14 +426,16 @@
 	if (!f)
 		return 0;
 
-	if (ast_write(chan, f)) {
-		ast_frfree(f);
-		return -1;
-	}
-
-	if (csth->fd) {
-		if (write(csth->fd, f->data.ptr, f->datalen) < 0) {
-			ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+	for (cur = f; cur; cur = AST_LIST_NEXT(cur, frame_list)) {
+		if (ast_write(chan, cur)) {
+			ast_frfree(f);
+			return -1;
+		}
+
+		if (csth->fd) {
+			if (write(csth->fd, cur->data.ptr, cur->datalen) < 0) {
+				ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+			}
 		}
 	}
 

Modified: team/wedhorn/readq-locking/apps/app_fax.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/apps/app_fax.c?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/apps/app_fax.c (original)
+++ team/wedhorn/readq-locking/apps/app_fax.c Thu Jun 18 17:21:45 2009
@@ -710,6 +710,7 @@
 	int res = 0;
 	char *parse;
 	fax_session session;
+	char restore_digit_detect = 0;
 
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(file_name);
@@ -744,7 +745,31 @@
 	session.chan = chan;
 	session.finished = 0;
 
+	/* get current digit detection mode, then disable digit detection if enabled */
+	{
+		int dummy = sizeof(restore_digit_detect);
+
+		ast_channel_queryoption(chan, AST_OPTION_DIGIT_DETECT, &restore_digit_detect, &dummy, 0);
+	}
+
+	if (restore_digit_detect) {
+		char new_digit_detect = 0;
+
+		ast_channel_setoption(chan, AST_OPTION_DIGIT_DETECT, &new_digit_detect, sizeof(new_digit_detect), 0);
+	}
+
+	/* disable FAX tone detection if enabled */
+	{
+		char new_fax_detect = 0;
+
+		ast_channel_setoption(chan, AST_OPTION_FAX_DETECT, &new_fax_detect, sizeof(new_fax_detect), 0);
+	}
+
 	res = transmit(&session);
+
+	if (restore_digit_detect) {
+		ast_channel_setoption(chan, AST_OPTION_DIGIT_DETECT, &restore_digit_detect, sizeof(restore_digit_detect), 0);
+	}
 
 	return res;
 }
@@ -754,6 +779,7 @@
 	int res = 0;
 	char *parse;
 	fax_session session;
+	char restore_digit_detect = 0;
 
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(file_name);
@@ -788,7 +814,31 @@
 	session.chan = chan;
 	session.finished = 0;
 
+	/* get current digit detection mode, then disable digit detection if enabled */
+	{
+		int dummy = sizeof(restore_digit_detect);
+
+		ast_channel_queryoption(chan, AST_OPTION_DIGIT_DETECT, &restore_digit_detect, &dummy, 0);
+	}
+
+	if (restore_digit_detect) {
+		char new_digit_detect = 0;
+
+		ast_channel_setoption(chan, AST_OPTION_DIGIT_DETECT, &new_digit_detect, sizeof(new_digit_detect), 0);
+	}
+
+	/* disable FAX tone detection if enabled */
+	{
+		char new_fax_detect = 0;
+
+		ast_channel_setoption(chan, AST_OPTION_FAX_DETECT, &new_fax_detect, sizeof(new_fax_detect), 0);
+	}
+
 	res = transmit(&session);
+
+	if (restore_digit_detect) {
+		ast_channel_setoption(chan, AST_OPTION_DIGIT_DETECT, &restore_digit_detect, sizeof(restore_digit_detect), 0);
+	}
 
 	return res;
 }

Modified: team/wedhorn/readq-locking/apps/app_meetme.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/apps/app_meetme.c?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/apps/app_meetme.c (original)
+++ team/wedhorn/readq-locking/apps/app_meetme.c Thu Jun 18 17:21:45 2009
@@ -3269,9 +3269,18 @@
 							}
 						}
 						if (conf->transframe[idx]) {
- 							if (conf->transframe[idx]->frametype != AST_FRAME_NULL) {
-	 							if (can_write(chan, confflags) && ast_write(chan, conf->transframe[idx])) {
-									ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
+ 							if ((conf->transframe[idx]->frametype != AST_FRAME_NULL) &&
+							    can_write(chan, confflags)) {
+								struct ast_frame *cur;
+								
+								/* the translator may have returned a list of frames, so
+								   write each one onto the channel
+								*/
+								for (cur = conf->transframe[idx]; cur; cur = AST_LIST_NEXT(cur, frame_list)) {
+									if (ast_write(chan, cur)) {
+										ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
+										break;
+									}
 								}
 							}
 						} else {

Modified: team/wedhorn/readq-locking/apps/app_mixmonitor.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/apps/app_mixmonitor.c?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/apps/app_mixmonitor.c (original)
+++ team/wedhorn/readq-locking/apps/app_mixmonitor.c Thu Jun 18 17:21:45 2009
@@ -50,7 +50,8 @@
 /*** DOCUMENTATION
 	<application name="MixMonitor" language="en_US">
 		<synopsis>
-			Record a call and mix the audio during the recording.
+			Record a call and mix the audio during the recording.  Use of StopMixMonitor is required
+			to guarantee the audio file is available for processing during dialplan execution.
 		</synopsis>
 		<syntax>
 			<parameter name="file" required="true" argsep=".">
@@ -112,7 +113,7 @@
 	</application>
 	<application name="StopMixMonitor" language="en_US">
 		<synopsis>
-			Stop recording a call through MixMonitor.
+			Stop recording a call through MixMonitor, and free the recording's file handle.
 		</synopsis>
 		<syntax />
 		<description>
@@ -141,6 +142,7 @@
 	char *name;
 	unsigned int flags;
 	struct ast_autochan *autochan;
+	struct mixmonitor_ds *mixmonitor_ds;
 };
 
 enum mixmonitor_flags {
@@ -166,6 +168,45 @@
 	AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
 });
 
+struct mixmonitor_ds {
+	unsigned int destruction_ok;
+	ast_cond_t destruction_condition;
+	ast_mutex_t lock;
+
+	/* The filestream is held in the datastore so it can be stopped
+	 * immediately during stop_mixmonitor or channel destruction. */
+	int fs_quit;
+	struct ast_filestream *fs;
+
+};
+
+static void mixmonitor_ds_close_fs(struct mixmonitor_ds *mixmonitor_ds)
+{
+	ast_mutex_lock(&mixmonitor_ds->lock);
+	if (mixmonitor_ds->fs) {
+		ast_closestream(mixmonitor_ds->fs);
+		mixmonitor_ds->fs = NULL;
+		mixmonitor_ds->fs_quit = 1;
+		ast_verb(2, "MixMonitor close filestream\n");
+	}
+	ast_mutex_unlock(&mixmonitor_ds->lock);
+}
+
+static void mixmonitor_ds_destroy(void *data)
+{
+	struct mixmonitor_ds *mixmonitor_ds = data;
+
+	ast_mutex_lock(&mixmonitor_ds->lock);
+	mixmonitor_ds->destruction_ok = 1;
+	ast_cond_signal(&mixmonitor_ds->destruction_condition);
+	ast_mutex_unlock(&mixmonitor_ds->lock);
+}
+
+static struct ast_datastore_info mixmonitor_ds_info = {
+	.type = "mixmonitor",
+	.destroy = mixmonitor_ds_destroy,
+};
+
 static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook) 
 {
 	struct ast_channel *peer = NULL;
@@ -184,19 +225,32 @@
 
 #define SAMPLES_PER_FRAME 160
 
+static void mixmonitor_free(struct mixmonitor *mixmonitor)
+{
+	if (mixmonitor) {
+		if (mixmonitor->mixmonitor_ds) {
+			ast_mutex_destroy(&mixmonitor->mixmonitor_ds->lock);
+			ast_cond_destroy(&mixmonitor->mixmonitor_ds->destruction_condition);
+			ast_free(mixmonitor->mixmonitor_ds);
+		}
+		ast_free(mixmonitor);
+	}
+}
 static void *mixmonitor_thread(void *obj) 
 {
 	struct mixmonitor *mixmonitor = obj;
-	struct ast_filestream *fs = NULL;
+	struct ast_filestream **fs = NULL;
 	unsigned int oflags;
 	char *ext;
 	int errflag = 0;
 
 	ast_verb(2, "Begin MixMonitor Recording %s\n", mixmonitor->name);
-	
+
 	ast_audiohook_lock(&mixmonitor->audiohook);
 
-	while (mixmonitor->audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
+	fs = &mixmonitor->mixmonitor_ds->fs;
+
+	while (mixmonitor->audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING && !mixmonitor->mixmonitor_ds->fs_quit) {
 		struct ast_frame *fr = NULL;
 
 		ast_audiohook_trigger_wait(&mixmonitor->audiohook);
@@ -208,25 +262,32 @@
 			continue;
 
 		if (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) || (mixmonitor->autochan->chan && ast_bridged_channel(mixmonitor->autochan->chan))) {
+			ast_mutex_lock(&mixmonitor->mixmonitor_ds->lock);
 			/* Initialize the file if not already done so */
-			if (!fs && !errflag) {
+			if (!*fs && !errflag && !mixmonitor->mixmonitor_ds->fs_quit) {
 				oflags = O_CREAT | O_WRONLY;
 				oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC;
-				
+
 				if ((ext = strrchr(mixmonitor->filename, '.')))
 					*(ext++) = '\0';
 				else
 					ext = "raw";
-				
-				if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0666))) {
+
+				if (!(*fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0666))) {
 					ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext);
 					errflag = 1;
 				}
 			}
-			
-			/* Write out frame */
-			if (fs)
-				ast_writestream(fs, fr);
+
+			/* Write out the frame(s) */
+			if (*fs) {
+				struct ast_frame *cur;
+
+				for (cur = fr; cur; cur = AST_LIST_NEXT(cur, frame_list)) {
+					ast_writestream(*fs, cur);
+				}
+			}
+			ast_mutex_unlock(&mixmonitor->mixmonitor_ds->lock);
 		}
 		/* All done! free it. */
 		ast_frame_free(fr, 0);
@@ -237,10 +298,8 @@
 	ast_audiohook_unlock(&mixmonitor->audiohook);
 	ast_audiohook_destroy(&mixmonitor->audiohook);
 
-	ast_verb(2, "End MixMonitor Recording %s\n", mixmonitor->name);
-
-	if (fs)
-		ast_closestream(fs);
+	mixmonitor_ds_close_fs(mixmonitor->mixmonitor_ds);
+
 
 	if (mixmonitor->post_process) {
 		ast_verb(2, "Executing [%s]\n", mixmonitor->post_process);
@@ -248,9 +307,46 @@
 	}
 
 	ast_autochan_destroy(mixmonitor->autochan);
-	ast_free(mixmonitor);
-
+
+	ast_mutex_lock(&mixmonitor->mixmonitor_ds->lock);
+	if (!mixmonitor->mixmonitor_ds->destruction_ok) {
+		ast_cond_wait(&mixmonitor->mixmonitor_ds->destruction_condition, &mixmonitor->mixmonitor_ds->lock);
+	}
+	ast_mutex_unlock(&mixmonitor->mixmonitor_ds->lock);
+
+
+	ast_verb(2, "End MixMonitor Recording %s\n", mixmonitor->name);
+	mixmonitor_free(mixmonitor);
 	return NULL;
+}
+
+static int setup_mixmonitor_ds(struct mixmonitor *mixmonitor, struct ast_channel *chan)
+{
+	struct ast_datastore *datastore = NULL;
+	struct mixmonitor_ds *mixmonitor_ds;
+
+	if (!(mixmonitor_ds = ast_calloc(1, sizeof(*mixmonitor_ds)))) {
+		return -1;
+	}
+
+	ast_mutex_init(&mixmonitor_ds->lock);
+	ast_cond_init(&mixmonitor_ds->destruction_condition, NULL);
+
+	if (!(datastore = ast_datastore_alloc(&mixmonitor_ds_info, NULL))) {
+		ast_mutex_destroy(&mixmonitor_ds->lock);
+		ast_cond_destroy(&mixmonitor_ds->destruction_condition);
+		ast_free(mixmonitor_ds);
+		return -1;
+	}
+
+	datastore->data = mixmonitor_ds;
+
+	ast_channel_lock(chan);
+	ast_channel_datastore_add(chan, datastore);
+	ast_channel_unlock(chan);
+
+	mixmonitor->mixmonitor_ds = mixmonitor_ds;
+	return 0;
 }
 
 static void launch_monitor_thread(struct ast_channel *chan, const char *filename, unsigned int flags,
@@ -287,6 +383,13 @@
 	/* Copy over flags and channel name */
 	mixmonitor->flags = flags;
 	if (!(mixmonitor->autochan = ast_autochan_setup(chan))) {
+		mixmonitor_free(mixmonitor);
+		return;
+	}
+
+	if (setup_mixmonitor_ds(mixmonitor, chan)) {
+		ast_autochan_destroy(mixmonitor->autochan);
+		mixmonitor_free(mixmonitor);
 		return;
 	}
 	mixmonitor->name = (char *) mixmonitor + sizeof(*mixmonitor);
@@ -406,6 +509,14 @@
 
 static int stop_mixmonitor_exec(struct ast_channel *chan, const char *data)
 {
+	struct ast_datastore *datastore = NULL;
+
+	/* closing the filestream here guarantees the file is avaliable to the dialplan
+	 * after calling StopMixMonitor */
+	if ((datastore = ast_channel_datastore_find(chan, &mixmonitor_ds_info, NULL))) {
+		mixmonitor_ds_close_fs(datastore->data);
+	}
+
 	ast_audiohook_detach_source(chan, mixmonitor_spy_type);
 	return 0;
 }

Modified: team/wedhorn/readq-locking/apps/app_rpt.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/apps/app_rpt.c?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/apps/app_rpt.c (original)
+++ team/wedhorn/readq-locking/apps/app_rpt.c Thu Jun 18 17:21:45 2009
@@ -3937,7 +3937,7 @@
 struct	rpt *myrpt;
 struct	rpt_link *l,*l1,linkbase;
 struct	ast_channel *mychannel;
-int id_malloc, vmajor, vminor, m;
+int vmajor, vminor, m;
 char *p,*ct,*ct_copy,*ident, *nodename,*cp;
 time_t t;
 #ifdef	NEW_ASTERISK
@@ -3984,14 +3984,10 @@
                 	ast_free(mytele);
                 	pthread_exit(NULL);
         	}
-		else{
-			id_malloc = 1;
-		}
 	}
 	else
 	{
 		ident = "";
-		id_malloc = 0;
 	}
 	rpt_mutex_unlock(&myrpt->lock);
 		
@@ -4007,8 +4003,7 @@
 		ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
 		rpt_mutex_unlock(&myrpt->lock);
 		ast_free(nodename);
-		if(id_malloc)
-			ast_free(ident);
+		ast_free(ident);
 		ast_free(mytele);		
 		pthread_exit(NULL);
 	}
@@ -4054,8 +4049,7 @@
 		rpt_mutex_unlock(&myrpt->lock);
 		ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
 		ast_free(nodename);
-		if(id_malloc)
-			ast_free(ident);
+		ast_free(ident);
 		ast_free(mytele);		
 		ast_hangup(mychannel);
 		pthread_exit(NULL);
@@ -4249,8 +4243,7 @@
 				rpt_mutex_unlock(&myrpt->lock);
 				ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
 				ast_free(nodename);
-				if(id_malloc)
-					ast_free(ident);
+				ast_free(ident);
 				ast_free(mytele);		
 				ast_hangup(mychannel);
 				pthread_exit(NULL);
@@ -4290,8 +4283,7 @@
 				rpt_mutex_unlock(&myrpt->lock);
 				ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
 				ast_free(nodename);
-				if(id_malloc)
-					ast_free(ident);
+				ast_free(ident);
 				ast_free(mytele);		
 				ast_hangup(mychannel);
 				pthread_exit(NULL);
@@ -4813,8 +4805,7 @@
 				rpt_mutex_unlock(&myrpt->lock);
 				ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
 				ast_free(nodename);
-				if(id_malloc)
-					ast_free(ident);
+				ast_free(ident);
 				ast_free(mytele);		
 				ast_hangup(mychannel);
 				pthread_exit(NULL);
@@ -5190,8 +5181,7 @@
 	myrpt->active_telem = NULL;
 	rpt_mutex_unlock(&myrpt->lock);
 	ast_free(nodename);
-	if(id_malloc)
-		ast_free(ident);
+	ast_free(ident);
 	ast_free(mytele);		
 	ast_hangup(mychannel);
 #ifdef  APP_RPT_LOCK_DEBUG

Modified: team/wedhorn/readq-locking/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/apps/app_voicemail.c?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/apps/app_voicemail.c (original)
+++ team/wedhorn/readq-locking/apps/app_voicemail.c Thu Jun 18 17:21:45 2009
@@ -3349,7 +3349,8 @@
 	char *c;
 	struct ast_config *cfg=NULL;
 	struct odbc_obj *obj;
-	struct insert_data idata = { .sql = sql, .msgnums = msgnums, .dir = dir, .mailboxuser = mailboxuser, .mailboxcontext = mailboxcontext };
+	struct insert_data idata = { .sql = sql, .msgnums = msgnums, .dir = dir, .mailboxuser = mailboxuser, .mailboxcontext = mailboxcontext,
+		.context = "", .macrocontext = "", .callerid = "", .origtime = "", .duration = "", .category = "", .flag = "" };
 	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 
 	delete_file(dir, msgnum);

Modified: team/wedhorn/readq-locking/autoconf/ast_gcc_attribute.m4
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/autoconf/ast_gcc_attribute.m4?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/autoconf/ast_gcc_attribute.m4 (original)
+++ team/wedhorn/readq-locking/autoconf/ast_gcc_attribute.m4 Thu Jun 18 17:21:45 2009
@@ -7,17 +7,10 @@
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
-if test "x$3" = "x"
-then
-attribute_scope="static"
-else
-attribute_scope="$3"
-fi
-
 if test "x$2" = "x"
 then
 AC_COMPILE_IFELSE(
-	AC_LANG_PROGRAM([$attribute_scope void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
+	AC_LANG_PROGRAM([$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
 			[]),
 	AC_MSG_RESULT(yes)
 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
@@ -25,7 +18,7 @@
 )
 else
 AC_COMPILE_IFELSE(
-	AC_LANG_PROGRAM([$attribute_scope void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}],
+	AC_LANG_PROGRAM([$3 void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}],
 			[]),
 	AC_MSG_RESULT(yes)
 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),

Modified: team/wedhorn/readq-locking/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/readq-locking/channels/chan_dahdi.c?view=diff&rev=201822&r1=201821&r2=201822
==============================================================================
--- team/wedhorn/readq-locking/channels/chan_dahdi.c (original)
+++ team/wedhorn/readq-locking/channels/chan_dahdi.c Thu Jun 18 17:21:45 2009
@@ -1507,6 +1507,7 @@
 static int dahdi_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen);
 static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen);
+static int dahdi_queryoption(struct ast_channel *chan, int option, void *data, int *datalen);
 static int dahdi_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len);
 static int handle_init_event(struct dahdi_pvt *i, int event);
 static int dahdi_func_write(struct ast_channel *chan, const char *function, char *data, const char *value);
@@ -1529,6 +1530,7 @@
 	.indicate = dahdi_indicate,
 	.fixup = dahdi_fixup,
 	.setoption = dahdi_setoption,
+	.queryoption = dahdi_queryoption,
 	.func_channel_read = dahdi_func_read,
 	.func_channel_write = dahdi_func_write,
 };
@@ -5817,6 +5819,66 @@
 	return res;
 }
 
+static void disable_dtmf_detect(struct dahdi_pvt *p)
+{
+	int val = 0;
+
+	p->ignoredtmf = 1;
+
+	ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
+
+	if (!p->hardwaredtmf && p->dsp) {
+		p->dsp_features &= ~DSP_FEATURE_DIGIT_DETECT;
+		ast_dsp_set_features(p->dsp, p->dsp_features);
+	}
+}
+
+static void enable_dtmf_detect(struct dahdi_pvt *p)
+{
+	int val = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
+
+	if (p->channel == CHAN_PSEUDO)
+		return;
+
+	p->ignoredtmf = 0;
+
+	ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
+
+	if (!p->hardwaredtmf && p->dsp) {
+		p->dsp_features |= DSP_FEATURE_DIGIT_DETECT;
+		ast_dsp_set_features(p->dsp, p->dsp_features);
+	}
+}
+
+static int dahdi_queryoption(struct ast_channel *chan, int option, void *data, int *datalen)
+{
+	char *cp;
+	struct dahdi_pvt *p = chan->tech_pvt;
+
+	/* all supported options require data */
+	if (!data || (*datalen < 1)) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	switch (option) {
+	case AST_OPTION_DIGIT_DETECT:
+		cp = (char *) data;
+		*cp = p->ignoredtmf ? 0 : 1;
+		ast_debug(1, "Reporting digit detection %sabled on %s\n", *cp ? "en" : "dis", chan->name);
+		break;
+	case AST_OPTION_FAX_DETECT:
+		cp = (char *) data;
+		*cp = (p->callprogress & CALLPROGRESS_FAX) ? 0 : 1;
+		ast_debug(1, "Reporting fax tone detection %sabled on %s\n", *cp ? "en" : "dis", chan->name);
+		break;
+	}
+
+	errno = 0;
+
+	return 0;
+}
+
 static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen)
 {
 	char *cp;
@@ -5999,6 +6061,29 @@
 			dahdi_disable_ec(p);
 		}
 		break;
+	case AST_OPTION_DIGIT_DETECT:
+		cp = (char *) data;
+		ast_debug(1, "%sabling digit detection on %s\n", *cp ? "En" : "Dis", chan->name);
+		if (*cp) {
+			enable_dtmf_detect(p);
+		} else {
+			disable_dtmf_detect(p);
+		}
+		break;
+	case AST_OPTION_FAX_DETECT:
+		cp = (char *) data;
+		if (p->dsp) {
+			ast_debug(1, "%sabling fax tone detection on %s\n", *cp ? "En" : "Dis", chan->name);
+			if (*cp) {
+				p->callprogress |= CALLPROGRESS_FAX;
+				p->dsp_features |= DSP_FEATURE_FAX_DETECT;
+			} else {
+				p->callprogress &= ~CALLPROGRESS_FAX;
+				p->dsp_features &= ~DSP_FEATURE_FAX_DETECT;
+			}
+			ast_dsp_set_features(p->dsp, p->dsp_features);
+		}
+		break;
 	default:
 		return -1;
 	}
@@ -6204,39 +6289,6 @@
 	slave->master = master;
 
 	ast_debug(1, "Making %d slave to master %d at %d\n", slave->channel, master->channel, x);
-}
-
-static void disable_dtmf_detect(struct dahdi_pvt *p)
-{
-	int val;
-

[... 3944 lines stripped ...]



More information about the svn-commits mailing list