[asterisk-commits] oej: branch oej/tilghman-chanvar-backport r274530 - in /team/oej/tilghman-cha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 7 05:04:26 CDT 2010


Author: oej
Date: Wed Jul  7 05:04:14 2010
New Revision: 274530

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=274530
Log:
Resolve, reset, move on folks.

Added:
    team/oej/tilghman-chanvar-backport/contrib/scripts/live_ast
      - copied unchanged from r274417, branches/1.4/contrib/scripts/live_ast
    team/oej/tilghman-chanvar-backport/doc/plc.txt
      - copied unchanged from r274417, branches/1.4/doc/plc.txt
    team/oej/tilghman-chanvar-backport/include/asterisk/test.h
      - copied unchanged from r274417, branches/1.4/include/asterisk/test.h
    team/oej/tilghman-chanvar-backport/main/test.c
      - copied unchanged from r274417, branches/1.4/main/test.c
    team/oej/tilghman-chanvar-backport/tests/
      - copied from r274417, branches/1.4/tests/
    team/oej/tilghman-chanvar-backport/tests/Makefile
      - copied unchanged from r274417, branches/1.4/tests/Makefile
    team/oej/tilghman-chanvar-backport/tests/test_astobj2.c
      - copied unchanged from r274417, branches/1.4/tests/test_astobj2.c
    team/oej/tilghman-chanvar-backport/tests/test_skel.c
      - copied unchanged from r274417, branches/1.4/tests/test_skel.c
Modified:
    team/oej/tilghman-chanvar-backport/   (props changed)
    team/oej/tilghman-chanvar-backport/Makefile
    team/oej/tilghman-chanvar-backport/README-SERIOUSLY.bestpractices.txt
    team/oej/tilghman-chanvar-backport/apps/app_directory.c
    team/oej/tilghman-chanvar-backport/apps/app_meetme.c
    team/oej/tilghman-chanvar-backport/apps/app_mixmonitor.c
    team/oej/tilghman-chanvar-backport/apps/app_queue.c
    team/oej/tilghman-chanvar-backport/apps/app_speech_utils.c
    team/oej/tilghman-chanvar-backport/apps/app_voicemail.c
    team/oej/tilghman-chanvar-backport/autoconf/libcurl.m4
    team/oej/tilghman-chanvar-backport/build_tools/cflags-devmode.xml
    team/oej/tilghman-chanvar-backport/build_tools/make_build_h
    team/oej/tilghman-chanvar-backport/cdr/cdr_tds.c
    team/oej/tilghman-chanvar-backport/channels/chan_agent.c
    team/oej/tilghman-chanvar-backport/channels/chan_dahdi.c
    team/oej/tilghman-chanvar-backport/channels/chan_h323.c
    team/oej/tilghman-chanvar-backport/channels/chan_iax2.c
    team/oej/tilghman-chanvar-backport/channels/chan_local.c
    team/oej/tilghman-chanvar-backport/channels/chan_misdn.c
    team/oej/tilghman-chanvar-backport/channels/chan_oss.c
    team/oej/tilghman-chanvar-backport/channels/chan_sip.c
    team/oej/tilghman-chanvar-backport/channels/h323/Makefile.in
    team/oej/tilghman-chanvar-backport/codecs/codec_adpcm.c
    team/oej/tilghman-chanvar-backport/codecs/codec_alaw.c
    team/oej/tilghman-chanvar-backport/codecs/codec_dahdi.c
    team/oej/tilghman-chanvar-backport/codecs/codec_g726.c
    team/oej/tilghman-chanvar-backport/codecs/codec_gsm.c
    team/oej/tilghman-chanvar-backport/codecs/codec_lpc10.c
    team/oej/tilghman-chanvar-backport/codecs/codec_ulaw.c
    team/oej/tilghman-chanvar-backport/config.guess
    team/oej/tilghman-chanvar-backport/configs/chan_dahdi.conf.sample
    team/oej/tilghman-chanvar-backport/configs/extensions.conf.sample
    team/oej/tilghman-chanvar-backport/configs/indications.conf.sample
    team/oej/tilghman-chanvar-backport/configs/manager.conf.sample
    team/oej/tilghman-chanvar-backport/configs/say.conf.sample
    team/oej/tilghman-chanvar-backport/configs/sip.conf.sample
    team/oej/tilghman-chanvar-backport/configs/sip_notify.conf.sample
    team/oej/tilghman-chanvar-backport/configs/voicemail.conf.sample
    team/oej/tilghman-chanvar-backport/configure
    team/oej/tilghman-chanvar-backport/configure.ac
    team/oej/tilghman-chanvar-backport/contrib/init.d/rc.debian.asterisk
    team/oej/tilghman-chanvar-backport/doc/HOWTO_collect_debug_information.txt
    team/oej/tilghman-chanvar-backport/doc/backtrace.txt
    team/oej/tilghman-chanvar-backport/doc/manager.txt
    team/oej/tilghman-chanvar-backport/doc/voicemail_odbc_postgresql.txt
    team/oej/tilghman-chanvar-backport/include/asterisk.h
    team/oej/tilghman-chanvar-backport/include/asterisk/app.h
    team/oej/tilghman-chanvar-backport/include/asterisk/audiohook.h
    team/oej/tilghman-chanvar-backport/include/asterisk/autoconfig.h.in
    team/oej/tilghman-chanvar-backport/include/asterisk/channel.h
    team/oej/tilghman-chanvar-backport/include/asterisk/compiler.h
    team/oej/tilghman-chanvar-backport/include/asterisk/file.h
    team/oej/tilghman-chanvar-backport/include/asterisk/linkedlists.h
    team/oej/tilghman-chanvar-backport/include/asterisk/lock.h
    team/oej/tilghman-chanvar-backport/include/asterisk/options.h
    team/oej/tilghman-chanvar-backport/include/asterisk/translate.h
    team/oej/tilghman-chanvar-backport/main/Makefile
    team/oej/tilghman-chanvar-backport/main/acl.c
    team/oej/tilghman-chanvar-backport/main/app.c
    team/oej/tilghman-chanvar-backport/main/ast_expr2.y
    team/oej/tilghman-chanvar-backport/main/asterisk.c
    team/oej/tilghman-chanvar-backport/main/audiohook.c
    team/oej/tilghman-chanvar-backport/main/autoservice.c
    team/oej/tilghman-chanvar-backport/main/callerid.c
    team/oej/tilghman-chanvar-backport/main/cdr.c
    team/oej/tilghman-chanvar-backport/main/channel.c
    team/oej/tilghman-chanvar-backport/main/cli.c
    team/oej/tilghman-chanvar-backport/main/config.c
    team/oej/tilghman-chanvar-backport/main/devicestate.c
    team/oej/tilghman-chanvar-backport/main/dnsmgr.c
    team/oej/tilghman-chanvar-backport/main/dsp.c
    team/oej/tilghman-chanvar-backport/main/editline/configure
    team/oej/tilghman-chanvar-backport/main/editline/configure.in
    team/oej/tilghman-chanvar-backport/main/file.c
    team/oej/tilghman-chanvar-backport/main/frame.c
    team/oej/tilghman-chanvar-backport/main/http.c
    team/oej/tilghman-chanvar-backport/main/loader.c
    team/oej/tilghman-chanvar-backport/main/logger.c
    team/oej/tilghman-chanvar-backport/main/manager.c
    team/oej/tilghman-chanvar-backport/main/pbx.c
    team/oej/tilghman-chanvar-backport/main/rtp.c
    team/oej/tilghman-chanvar-backport/main/term.c
    team/oej/tilghman-chanvar-backport/main/translate.c
    team/oej/tilghman-chanvar-backport/makeopts.in
    team/oej/tilghman-chanvar-backport/pbx/Makefile
    team/oej/tilghman-chanvar-backport/pbx/pbx_ael.c
    team/oej/tilghman-chanvar-backport/pbx/pbx_dundi.c
    team/oej/tilghman-chanvar-backport/res/res_agi.c
    team/oej/tilghman-chanvar-backport/res/res_config_pgsql.c
    team/oej/tilghman-chanvar-backport/res/res_features.c
    team/oej/tilghman-chanvar-backport/res/res_jabber.c
    team/oej/tilghman-chanvar-backport/res/res_monitor.c
    team/oej/tilghman-chanvar-backport/res/res_musiconhold.c
    team/oej/tilghman-chanvar-backport/sounds/Makefile

Propchange: team/oej/tilghman-chanvar-backport/
------------------------------------------------------------------------------
    automerge = http://www.codename-pineapple.org/

Propchange: team/oej/tilghman-chanvar-backport/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul  7 05:04:14 2010
@@ -1,1 +1,1 @@
-/branches/1.4:1-256949
+/branches/1.4:1-274529

Modified: team/oej/tilghman-chanvar-backport/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/Makefile?view=diff&rev=274530&r1=274529&r2=274530
==============================================================================
--- team/oej/tilghman-chanvar-backport/Makefile (original)
+++ team/oej/tilghman-chanvar-backport/Makefile Wed Jul  7 05:04:14 2010
@@ -57,6 +57,7 @@
 export AR
 export RANLIB
 export HOST_CC
+export BUILD_CC
 export STATIC_BUILD
 export INSTALL
 export DESTDIR
@@ -66,7 +67,6 @@
 export DOWNLOAD
 export AWK
 export GREP
-export ID
 export OSARCH
 export CURSES_DIR
 export NCURSES_DIR
@@ -265,7 +265,7 @@
 
 _ASTCFLAGS+=$(BUSYDETECT)$(OPTIONS)
 
-MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
+MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs tests main
 OTHER_SUBDIRS:=utils agi
 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
@@ -293,7 +293,12 @@
   SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
 endif
 
-SUBMAKE=$(MAKE) --quiet --no-print-directory
+SILENTMAKE:=$(MAKE) --quiet --no-print-directory
+ifneq ($(PRINT_DIR)$(NOISY_BUILD),)
+SUBMAKE:=$(MAKE)
+else
+SUBMAKE:=$(MAKE) --quiet --no-print-directory
+endif
 
 # This is used when generating the doxygen documentation
 ifneq ($(DOT),:)
@@ -330,13 +335,13 @@
 endif
 
 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
-	+ at echo "EMBED_LDSCRIPTS+="`$(SUBMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
+	+ at echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
 
 $(MOD_SUBDIRS_EMBED_LDFLAGS):
-	+ at echo "EMBED_LDFLAGS+="`$(SUBMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
+	+ at echo "EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
 
 $(MOD_SUBDIRS_EMBED_LIBS):
-	+ at echo "EMBED_LIBS+="`$(SUBMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
+	+ at echo "EMBED_LIBS+="`$(SILENTMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
 
 $(MOD_SUBDIRS_MENUSELECT_TREE):
 	+@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
@@ -414,9 +419,7 @@
 	rm -f build_tools/menuselect-deps
 
 datafiles: _all
-	if [ `$(ID) -u` = 0 ]; then \
-		CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; \
-	fi
+	CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig $(DESTDIR)$(libdir)/pkgconfig;
 # Should static HTTP be installed during make samples or even with its own target ala
 # webvoicemail?  There are portions here that *could* be customized but might also be
 # improved a lot.  I'll put it here for now.
@@ -627,6 +630,7 @@
 		echo "                        ; to the device.  It is for this reason that this is optional, as it may result in requiring a" ; \
 		echo "                        ; temporary codec translation path for a channel that may not otherwise require one." ; \
 		echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
+		echo ";sendfullybooted = yes  ; Send the FullyBooted AMI event on AMI login and when all modules are finished loading" ; \
 		echo ";runuser = asterisk ; The user to run as" ; \
 		echo ";rungroup = asterisk ; The group to run as" ; \
 		echo ";dahdichanname = yes ; Channels created by chan_dahdi will be called 'DAHDI', otherwise 'Zap'" ; \
@@ -785,7 +789,7 @@
 	- at menuselect/nmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 # options for make in menuselect/
-MAKE_MENUSELECT=CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
+MAKE_MENUSELECT=CC="$(BUILD_CC)" CXX="" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
 
 menuselect/menuselect: menuselect/makeopts
 	+$(MAKE_MENUSELECT) menuselect
@@ -807,8 +811,8 @@
 	@echo "<?xml version=\"1.0\"?>" > $@
 	@echo >> $@
 	@echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
-	+ at for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
-	+ at for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
+	+ at for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
+	+ at for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
 	@cat build_tools/cflags.xml >> $@
 	@if [ "${AST_DEVMODE}" = "yes" ]; then \
 		cat build_tools/cflags-devmode.xml >> $@; \

Modified: team/oej/tilghman-chanvar-backport/README-SERIOUSLY.bestpractices.txt
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/README-SERIOUSLY.bestpractices.txt?view=diff&rev=274530&r1=274529&r2=274530
==============================================================================
--- team/oej/tilghman-chanvar-backport/README-SERIOUSLY.bestpractices.txt (original)
+++ team/oej/tilghman-chanvar-backport/README-SERIOUSLY.bestpractices.txt Wed Jul  7 05:04:14 2010
@@ -121,7 +121,7 @@
 
 [incoming]
 exten => _X.,1,Verbose(2,Incoming call to extension ${EXTEN})
-exten => _X.,n,Dial(SIP/${FILTER(0-9,${EXTEN})})
+exten => _X.,n,Dial(SIP/${FILTER(0123456789,${EXTEN})})
 exten => _X.,n,Hangup()
 
 Note how we've wrapped the ${EXTEN} channel variable with the FILTER() function
@@ -135,7 +135,7 @@
 
 [incoming]
 exten => _X.,1,Verbose(2,Incoming call to extension ${EXTEN})
-exten => _X.,n,Set(SAFE_EXTEN=${FILTER(0-9,${EXTEN})})
+exten => _X.,n,Set(SAFE_EXTEN=${FILTER(0123456789,${EXTEN})})
 exten => _X.,n,Dial(SIP/${SAFE_EXTEN})
 exten => _X.,n,Hangup()
 
@@ -146,7 +146,7 @@
 
 [incoming]
 exten => _X.,1,Verbose(2,Incoming call to extension ${EXTEN})
-exten => _X.,n,Set(SAFE_EXTEN=${FILTER(0-9,${EXTEN})})
+exten => _X.,n,Set(SAFE_EXTEN=${FILTER(0123456789,${EXTEN})})
 exten => _X.,n,GotoIf($[${EXTEN} != ${SAFE_EXTEN}]?error,1)
 exten => _X.,n,Dial(SIP/${SAFE_EXTEN})
 exten => _X.,n,Hangup()
@@ -161,7 +161,7 @@
 
 [incoming]
 exten => _[0-9a-zA-Z].,1,Verbose(2,Incoming call to extension ${EXTEN})
-exten => _[0-9a-zA-Z].,n,Dial(SIP/${FILTER(. at 0-9a-zA-Z,${EXTEN})
+exten => _[0-9a-zA-Z].,n,Dial(SIP/${FILTER(. at 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,${EXTEN})
 exten => _[0-9a-zA-Z].,n,Hangup()
 
 Of course the FILTER() function doesn't check the formatting of the incoming

Modified: team/oej/tilghman-chanvar-backport/apps/app_directory.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/apps/app_directory.c?view=diff&rev=274530&r1=274529&r2=274530
==============================================================================
--- team/oej/tilghman-chanvar-backport/apps/app_directory.c (original)
+++ team/oej/tilghman-chanvar-backport/apps/app_directory.c Wed Jul  7 05:04:14 2010
@@ -329,6 +329,14 @@
 	
 		if (res < 0) /* User hungup, so jump out now */
 			break;
+		if (res == '0') {
+		if (!ast_goto_if_exists(chan, dialcontext, "o", 1) ||
+		    (!ast_strlen_zero(chan->macrocontext) &&
+		     !ast_goto_if_exists(chan, chan->macrocontext, "o", 1))) {
+			/* return 1 to indicate goto has been performed */
+			return '1';
+			}
+		}
 		if (res == '1') {	/* Name selected */
 			if (fromappvm) {
 				/* We still want to set the exten though */
@@ -345,6 +353,8 @@
 			break;
 		}
 		if (res == '*') /* Skip to next match in list */
+			break;
+		if (res == '#')
 			break;
 
 		/* Not '1', or '*', so decrement number of tries */
@@ -516,6 +526,9 @@
 						lastuserchoice = res;
 						res = 0;
 						break;
+					case '#':
+						lastuserchoice = res;
+						return 0;
 					default:
 						break;
 				}
@@ -645,6 +658,8 @@
 		dirintro = ast_variable_retrieve(cfg, "general", "directoryintro");
 	if (ast_strlen_zero(dirintro))
 		dirintro = last ? "dir-intro" : "dir-intro-fn";
+	/* the above prompts probably should be modified to include 0 for dialing operator
+	   and # for exiting (continues in dialplan) */
 
 	if (chan->_state != AST_STATE_UP) 
 		res = ast_answer(chan);

Modified: team/oej/tilghman-chanvar-backport/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/apps/app_meetme.c?view=diff&rev=274530&r1=274529&r2=274530
==============================================================================
--- team/oej/tilghman-chanvar-backport/apps/app_meetme.c (original)
+++ team/oej/tilghman-chanvar-backport/apps/app_meetme.c Wed Jul  7 05:04:14 2010
@@ -2322,6 +2322,20 @@
 					}
 				} else if (f->frametype == AST_FRAME_NULL) {
 					/* Ignore NULL frames. It is perfectly normal to get these if the person is muted. */
+				} else if (f->frametype == AST_FRAME_CONTROL) {
+					switch (f->subclass) {
+					case AST_CONTROL_BUSY:
+					case AST_CONTROL_CONGESTION:
+						ast_frfree(f);
+						goto outrun;
+						break;
+					default:
+						if (option_debug) {
+							ast_log(LOG_DEBUG, 
+								"Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n",
+								chan->name, f->frametype, f->subclass);
+						}
+					}
 				} else if (option_debug) {
 					ast_log(LOG_DEBUG,
 						"Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
@@ -2352,6 +2366,10 @@
 						ast_mutex_lock(&conf->listenlock);
 						if (!conf->transframe[index]) {
 							if (conf->origframe) {
+								if (musiconhold && !ast_dsp_silence(dsp, conf->origframe, &confsilence) && confsilence < MEETME_DELAYDETECTTALK) {
+									ast_moh_stop(chan);
+									mohtempstopped = 1;
+								}
 								if (!conf->transpath[index])
 									conf->transpath[index] = ast_translator_build_path((1 << index), AST_FORMAT_SLINEAR);
 								if (conf->transpath[index]) {
@@ -2365,11 +2383,6 @@
 							if ((conf->transframe[index]->frametype != AST_FRAME_NULL) &&
 							    can_write(chan, confflags)) {
 								struct ast_frame *cur;
-								if (musiconhold && !ast_dsp_silence(dsp, conf->transframe[index], &confsilence) && confsilence < MEETME_DELAYDETECTTALK) {
-									ast_moh_stop(chan);
-									mohtempstopped = 1;
-								}
-
 								/* the translator may have returned a list of frames, so
 								   write each one onto the channel
 								*/
@@ -2874,10 +2887,10 @@
 				if (allowretry)
 					confno[0] = '\0';
 			} else {
-				if ((!ast_strlen_zero(cnf->pin) &&
-				     !ast_test_flag(&confflags, CONFFLAG_ADMIN)) ||
-				    (!ast_strlen_zero(cnf->pinadmin) &&
-				     ast_test_flag(&confflags, CONFFLAG_ADMIN))) {
+				if (((!ast_strlen_zero(cnf->pin) &&
+				    !ast_test_flag(&confflags, CONFFLAG_ADMIN)) ||
+				    !ast_strlen_zero(cnf->pinadmin)) &&
+				    (!(cnf->users == 0 && cnf->isdynamic))) {
 					char pin[MAX_PIN] = "";
 					int j;
 

Modified: team/oej/tilghman-chanvar-backport/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/apps/app_mixmonitor.c?view=diff&rev=274530&r1=274529&r2=274530
==============================================================================
--- team/oej/tilghman-chanvar-backport/apps/app_mixmonitor.c (original)
+++ team/oej/tilghman-chanvar-backport/apps/app_mixmonitor.c Wed Jul  7 05:04:14 2010
@@ -256,13 +256,14 @@
 	while (mixmonitor->audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING && !mixmonitor->mixmonitor_ds->fs_quit) {
 		struct ast_frame *fr = NULL;
 
-		ast_audiohook_trigger_wait(&mixmonitor->audiohook);
-
-		if (mixmonitor->audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING)
-			break;
-
-		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR)))
+		if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR))) {
+			ast_audiohook_trigger_wait(&mixmonitor->audiohook);
+
+			if (mixmonitor->audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING) {
+				break;
+			}
 			continue;
+		}
 
 		/* audiohook lock is not required for the next block.
 		 * Unlock it, but remember to lock it before looping or exiting */

Modified: team/oej/tilghman-chanvar-backport/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/apps/app_queue.c?view=diff&rev=274530&r1=274529&r2=274530
==============================================================================
--- team/oej/tilghman-chanvar-backport/apps/app_queue.c (original)
+++ team/oej/tilghman-chanvar-backport/apps/app_queue.c Wed Jul  7 05:04:14 2010
@@ -574,10 +574,13 @@
 	struct member *member;
 	struct ao2_iterator mem_iter;
 	enum queue_member_status result = QUEUE_NO_MEMBERS;
+	int allpaused = 1, empty = 1;
 
 	ao2_lock(q);
 	mem_iter = ao2_iterator_init(q->members, 0);
 	while ((member = ao2_iterator_next(&mem_iter))) {
+		empty = 0;
+
 		if (max_penalty && (member->penalty > max_penalty)) {
 			ao2_ref(member, -1);
 			continue;
@@ -586,6 +589,8 @@
 		if (member->paused) {
 			ao2_ref(member, -1);
 			continue;
+		} else {
+			allpaused = 0;
 		}
 
 		switch (member->status) {
@@ -605,6 +610,10 @@
 	}
 	ao2_iterator_destroy(&mem_iter);
 	ao2_unlock(q);
+
+	if (!empty && allpaused) {
+		result = QUEUE_NO_REACHABLE_MEMBERS;
+	}
 	return result;
 }
 
@@ -1529,6 +1538,10 @@
 	int res;
 
 	if (ast_strlen_zero(filename)) {
+		return 0;
+	}
+
+	if (!ast_fileexists(filename, NULL, chan->language)) {
 		return 0;
 	}
 
@@ -3112,7 +3125,6 @@
 				ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", peer->name);
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long)time(NULL) - qe->start);
 				record_abandoned(qe);
-				ast_cdr_noanswer(qe->chan->cdr);
 				ast_hangup(peer);
 				ao2_ref(member, -1);
 				return -1;
@@ -3283,6 +3295,20 @@
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
 					qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
 					(long) (time(NULL) - callstart));
+				if (qe->parent->eventwhencalled)
+					manager_event(EVENT_FLAG_AGENT, "AgentComplete",
+							"Queue: %s\r\n"
+							"Uniqueid: %s\r\n"
+							"Channel: %s\r\n"
+							"Member: %s\r\n"
+							"MemberName: %s\r\n"
+							"HoldTime: %ld\r\n"
+							"TalkTime: %ld\r\n"
+							"Reason: transfer\r\n"
+							"%s",
+							queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername,
+							(long)(callstart - qe->start), (long)(time(NULL) - callstart),
+							qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
 			} else if (qe->chan->_softhangup) {
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
 					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
@@ -3308,12 +3334,13 @@
 							"Queue: %s\r\n"
 							"Uniqueid: %s\r\n"
 							"Channel: %s\r\n"
+							"Member: %s\r\n"
 							"MemberName: %s\r\n"
 							"HoldTime: %ld\r\n"
 							"TalkTime: %ld\r\n"
 							"Reason: agent\r\n"
 							"%s",
-							queuename, qe->chan->uniqueid, peer->name, member->membername, (long)(callstart - qe->start),
+							queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername, (long)(callstart - qe->start),
 							(long)(time(NULL) - callstart),
 							qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
 			}
@@ -3321,6 +3348,21 @@
 				ast_channel_datastore_remove(qe->chan, tds);
 			}
 			update_queue(qe->parent, member, callcompletedinsl);
+		} else {
+			if (qe->parent->eventwhencalled)
+				manager_event(EVENT_FLAG_AGENT, "AgentComplete",
+						"Queue: %s\r\n"
+						"Uniqueid: %s\r\n"
+						"Channel: %s\r\n"
+						"Member: %s\r\n"
+						"MemberName: %s\r\n"
+						"HoldTime: %ld\r\n"
+						"TalkTime: %ld\r\n"
+						"Reason: transfer\r\n"
+						"%s",
+						queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername, (long)(callstart - qe->start),
+						(long)(time(NULL) - callstart),
+						qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
 		}
 
 		if (transfer_ds) {
@@ -4085,7 +4127,6 @@
 			/* Leave if we have exceeded our queuetimeout */
 			if (qe.expire && (time(NULL) >= qe.expire)) {
 				record_abandoned(&qe);
-				ast_cdr_noanswer(qe.chan->cdr);
 				reason = QUEUE_TIMEOUT;
 				res = 0;
 				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
@@ -4104,7 +4145,6 @@
 			/* Leave if we have exceeded our queuetimeout */
 			if (qe.expire && (time(NULL) >= qe.expire)) {
 				record_abandoned(&qe);
-				ast_cdr_noanswer(qe.chan->cdr);
 				reason = QUEUE_TIMEOUT;
 				res = 0;
 				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
@@ -4118,7 +4158,6 @@
 			/* Leave if we have exceeded our queuetimeout */
 			if (qe.expire && (time(NULL) >= qe.expire)) {
 				record_abandoned(&qe);
-				ast_cdr_noanswer(qe.chan->cdr);
 				reason = QUEUE_TIMEOUT;
 				res = 0;
 				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
@@ -4137,7 +4176,6 @@
 					ast_verbose(VERBOSE_PREFIX_3 "Exiting on time-out cycle\n");
 				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
 				record_abandoned(&qe);
-				ast_cdr_noanswer(qe.chan->cdr);
 				reason = QUEUE_TIMEOUT;
 				res = 0;
 				break;
@@ -4146,7 +4184,6 @@
 			/* leave the queue if no agents, if enabled */
 			if (qe.parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
 				record_abandoned(&qe);
-				ast_cdr_noanswer(qe.chan->cdr);
 				reason = QUEUE_LEAVEEMPTY;
 				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe.pos, qe.opos, (long)(time(NULL) - qe.start));
 				res = 0;
@@ -4156,7 +4193,6 @@
 			/* leave the queue if no reachable agents, if enabled */
 			if ((qe.parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
 				record_abandoned(&qe);
-				ast_cdr_noanswer(qe.chan->cdr);
 				reason = QUEUE_LEAVEUNAVAIL;
 				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe.pos, qe.opos, (long)(time(NULL) - qe.start));
 				res = 0;
@@ -4166,7 +4202,6 @@
 			/* Leave if we have exceeded our queuetimeout */
 			if (qe.expire && (time(NULL) >= qe.expire)) {
 				record_abandoned(&qe);
-				ast_cdr_noanswer(qe.chan->cdr);
 				reason = QUEUE_TIMEOUT;
 				res = 0;
 				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
@@ -4198,7 +4233,6 @@
 			if (res < 0) {
 				if (!qe.handled) {
 					record_abandoned(&qe);
-					ast_cdr_noanswer(qe.chan->cdr);
 					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON",
 						"%d|%d|%ld", qe.pos, qe.opos,
 						(long) time(NULL) - qe.start);

Modified: team/oej/tilghman-chanvar-backport/apps/app_speech_utils.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/apps/app_speech_utils.c?view=diff&rev=274530&r1=274529&r2=274530
==============================================================================
--- team/oej/tilghman-chanvar-backport/apps/app_speech_utils.c (original)
+++ team/oej/tilghman-chanvar-backport/apps/app_speech_utils.c Wed Jul  7 05:04:14 2010
@@ -735,6 +735,7 @@
 				if (dtmf_terminator != '\0' && f->subclass == dtmf_terminator) {
 					done = 1;
 				} else {
+					quieted = 1;
 					if (chan->stream != NULL) {
 						ast_stopstream(chan);
 					}

Modified: team/oej/tilghman-chanvar-backport/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/apps/app_voicemail.c?view=diff&rev=274530&r1=274529&r2=274530
==============================================================================
--- team/oej/tilghman-chanvar-backport/apps/app_voicemail.c (original)
+++ team/oej/tilghman-chanvar-backport/apps/app_voicemail.c Wed Jul  7 05:04:14 2010
@@ -212,6 +212,7 @@
 #define VM_TEMPGREETWARN (1 << 15)  /*!< Remind user tempgreeting is set */
 #define ERROR_LOCK_PATH  -100
 #define ERROR_MAILBOX_FULL	-200
+#define OPERATOR_EXIT		300
 
 
 enum {
@@ -1192,9 +1193,10 @@
 
 	fprintf(text_file_ptr, "%s\n", "[message]");
 
+	cid_name = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:");
+	fprintf(text_file_ptr, "callerid=\"%s\" ", S_OR(cid_name, ""));
 	cid_num = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:");
-	cid_name = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:");
-	fprintf(text_file_ptr, "callerid=\"%s\" <%s>\n", S_OR(cid_name, ""), S_OR(cid_num, ""));
+	fprintf(text_file_ptr, "<%s>\n", S_OR(cid_num, ""));
 	context = get_header_by_tag(header_content, "X-Asterisk-VM-Context:");
 	fprintf(text_file_ptr, "context=%s\n", S_OR(context, ""));
 	origtime = get_header_by_tag(header_content, "X-Asterisk-VM-Orig-time:");
@@ -1336,6 +1338,39 @@
 	return 0;
 }
 
+static int imap_check_limits(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu, int msgnum)
+{
+	int res;
+
+	/* Check if mailbox is full */
+	check_quota(vms, imapfolder);
+	if (vms->quota_limit && vms->quota_usage >= vms->quota_limit) {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "*** QUOTA EXCEEDED!! %u >= %u\n", vms->quota_usage, vms->quota_limit);
+		ast_play_and_wait(chan, "vm-mailboxfull");
+		return -1;
+	}
+	if (option_debug > 2)
+		ast_log(LOG_DEBUG, "Checking message number quota - mailbox has %d messages, maximum is set to %d\n",msgnum,vmu->maxmsg);
+	if (msgnum >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context, 0)) {
+		res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
+		if (!res)
+			res = ast_waitstream(chan, "");
+		ast_log(LOG_WARNING, "No more messages possible\n");
+		pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+		return -1;
+	}
+
+	/* Check if we have exceeded maxmsg */
+	if (msgnum >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context, +1)) {
+		ast_log(LOG_WARNING, "Unable to leave message since we will exceed the maximum number of messages allowed (%u > %u)\n", msgnum, vmu->maxmsg);
+		ast_play_and_wait(chan, "vm-mailboxfull");
+		inprocess_count(vmu->mailbox, vmu->context, -1);
+		return -1;
+	}
+	return 0;
+}
+
 static int imap_store_file(char *dir, char *mailboxuser, char *mailboxcontext, int msgnum, struct ast_channel *chan, struct ast_vm_user *vmu, char *fmt, int duration, struct vm_state *vms)
 {
 	char *myserveremail = serveremail;
@@ -1348,10 +1383,15 @@
 	void *buf;
 	int tempcopy = 0;
 	STRING str;
+	int msgcount = (messagecount(vmu->context, vmu->mailbox, "INBOX") + messagecount(vmu->context, vmu->mailbox, "Old"));
 
 	/*Greetings are not retrieved from IMAP, so there is no reason to attempt storing them there either*/
 	if (msgnum < 0)
 		return 0;
+
+	if (imap_check_limits(chan, vms, vmu, msgcount)) {
+		return -1;
+	}
 
 	/* Attach only the first format */
 	fmt = ast_strdupa(fmt);
@@ -1550,7 +1590,11 @@
 		ast_build_string(&t, &left, "/%s", imapflags);
 
 	/* End with username */
+#if 1
 	ast_build_string(&t, &left, "/user=%s}", vms->imapuser);
+#else
+	ast_build_string(&t, &left, "/user=%s/novalidate-cert}", vms->imapuser);
+#endif
 
 	if (box == 0 || box == 1)
 		snprintf(spec, len, "%s%s", tmp, use_folder? imapfolder: "INBOX");
@@ -2877,6 +2921,7 @@
 }
 #endif
 
+#ifndef IMAP_STORAGE
 static int copy(char *infile, char *outfile)
 {
 	int ifd;
@@ -2926,7 +2971,9 @@
 	}
 #endif
 }
-
+#endif
+
+#ifndef IMAP_STORAGE
 static void copy_plain_file(char *frompath, char *topath)
 {
 	char frompath2[PATH_MAX], topath2[PATH_MAX];
@@ -2935,7 +2982,9 @@
 	snprintf(topath2, sizeof(topath2), "%s.txt", topath);
 	copy(frompath2, topath2);
 }
-
+#endif
+
+#ifndef IMAP_STORAGE
 static int vm_delete(char *file)
 {
 	char *txt;
@@ -2950,6 +2999,7 @@
 	unlink(txt);
 	return ast_filedelete(file, NULL);
 }
+#endif
 
 static int inbuf(struct baseio *bio, FILE *fi)
 {
@@ -3494,7 +3544,7 @@
 						ast_log(LOG_DEBUG, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox);
 					}
 				} else {
-					ast_log(LOG_WARNING, "Sox failed to reencode %s.%s: %s (have you installed support for all sox file formats?)\n", attach, format,
+					ast_log(LOG_WARNING, "Sox failed to re-encode %s.%s: %s (have you installed support for all sox file formats?)\n", attach, format,
 						soxstatus == 1 ? "Problem with command line options" : "An error occurred during file processing");
 					ast_log(LOG_WARNING, "Voicemail attachment will have no volume gain.\n");
 				}
@@ -3859,6 +3909,7 @@
 	char fromdir[PATH_MAX], todir[PATH_MAX], frompath[PATH_MAX], topath[PATH_MAX];
 	const char *frombox = mbox(imbox);
 	int recipmsgnum;
+	int res = 0;
 
 	ast_log(LOG_NOTICE, "Copying message from %s@%s to %s@%s\n", vmu->mailbox, vmu->context, recip->mailbox, recip->context);
 
@@ -3896,11 +3947,12 @@
 		}
 	} else {
 		ast_log(LOG_ERROR, "Recipient mailbox %s@%s is full\n", recip->mailbox, recip->context);
+		res = -1;
 	}
 	ast_unlock_path(todir);
 	notify_new_message(chan, recip, recipmsgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL));
 	
-	return 0;
+	return res;
 }
 #endif
 #if !(defined(IMAP_STORAGE) || defined(ODBC_STORAGE))
@@ -4225,7 +4277,7 @@
 			free_user(vmu);
 			pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
 		}
-		return 0;
+		return OPERATOR_EXIT;
 	}
 	if (res < 0) {
 		free_user(vmu);
@@ -4262,31 +4314,8 @@
 		/* set variable for compatability */
 		pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", "IMAP_STORAGE");
 
-		/* Check if mailbox is full */
-		check_quota(vms, imapfolder);
-		if (vms->quota_limit && vms->quota_usage >= vms->quota_limit) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "*** QUOTA EXCEEDED!! %u >= %u\n", vms->quota_usage, vms->quota_limit);
-			ast_play_and_wait(chan, "vm-mailboxfull");
-			return -1;
-		}
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "Checking message number quota - mailbox has %d messages, maximum is set to %d\n",msgnum,vmu->maxmsg);
-		if (msgnum >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context, 0)) {
-			res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
-			if (!res)
-				res = ast_waitstream(chan, "");
-			ast_log(LOG_WARNING, "No more messages possible\n");
-			pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
+		if (imap_check_limits(chan, vms, vmu, msgnum)) {
 			goto leave_vm_out;
-		}
-
-		/* Check if we have exceeded maxmsg */
-		if (msgnum >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context, +1)) {
-			ast_log(LOG_WARNING, "Unable to leave message since we will exceed the maximum number of messages allowed (%u > %u)\n", msgnum, vmu->maxmsg);
-			ast_play_and_wait(chan, "vm-mailboxfull");
-			inprocess_count(vmu->mailbox, vmu->context, -1);
-			return -1;
 		}
 #else
 		if (count_messages(vmu, dir) >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context, +1)) {
@@ -5067,10 +5096,16 @@
 static int get_folder2(struct ast_channel *chan, char *fn, int start)
 {
 	int res = 0;
+	int loops = 0;
 	res = ast_play_and_wait(chan, fn);	/* Folder name */
 	while (((res < '0') || (res > '9')) &&
-			(res != '#') && (res >= 0)) {
+			(res != '#') && (res >= 0) &&
+			loops < 4) {
 		res = get_folder(chan, 0);
+		loops++;
+	}
+	if (loops == 4) { /* give up */
+		return '#';
 	}
 	return res;
 }
@@ -5082,26 +5117,28 @@
 	int retries = 0, prepend_duration = 0, already_recorded = 0;
 	signed char zero_gain = 0;
 	struct ast_config *msg_cfg;
-	const char *duration_str;
-	char msgfile[PATH_MAX], backup[PATH_MAX], backup_textfile[PATH_MAX];
+	const char *duration_cstr;
+	char msgfile[PATH_MAX], backup[PATH_MAX];
 	char textfile[PATH_MAX];
-
+	struct ast_category *msg_cat;
+	char duration_str[12] = "";
+
+	ast_log(LOG_NOTICE, "curdir=%s\n", curdir);
 	/* Must always populate duration correctly */
 	make_file(msgfile, sizeof(msgfile), curdir, curmsg);
 	strcpy(textfile, msgfile);
 	strcpy(backup, msgfile);
-	strcpy(backup_textfile, msgfile);
 	strncat(textfile, ".txt", sizeof(textfile) - strlen(textfile) - 1);
 	strncat(backup, "-bak", sizeof(backup) - strlen(backup) - 1);
-	strncat(backup_textfile, "-bak.txt", sizeof(backup_textfile) - strlen(backup_textfile) - 1);
 
 	if (!(msg_cfg = ast_config_load(textfile))) {
 		return -1;
 	}
 
 	*duration = 0;
-	if ((duration_str = ast_variable_retrieve(msg_cfg, "message", "duration")))
-		*duration = atoi(duration_str);
+	if ((duration_cstr = ast_variable_retrieve(msg_cfg, "message", "duration"))) {
+		*duration = atoi(duration_cstr);
+	}
 
 	while ((cmd >= 0) && (cmd != 't') && (cmd != '*')) {
 		if (cmd)
@@ -5112,19 +5149,11 @@
 		{
 			prepend_duration = 0;
 
-			/* if we can't read the message metadata, stop now */
-			if (!msg_cfg) {
-				cmd = 0;
-				break;
-			}
-
 			/* Back up the original file, so we can retry the prepend */
 			if (already_recorded) {
 				ast_filecopy(backup, msgfile, NULL);
-				copy(backup_textfile, textfile);
 			} else {
 				ast_filecopy(msgfile, backup, NULL);
-				copy(textfile, backup_textfile);
 			}
 			already_recorded = 1;
 
@@ -5136,16 +5165,7 @@
 				ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
 
 			if (prepend_duration) {
-				struct ast_category *msg_cat;
-				/* need enough space for a maximum-length message duration */
-				char duration_str[12];
-
 				prepend_duration += *duration;
-				msg_cat = ast_category_get(msg_cfg, "message");
-				snprintf(duration_str, 11, "%d", prepend_duration);
-				if (!ast_variable_update(msg_cat, "duration", duration_str, NULL, 0)) {
-					config_text_file_save(textfile, msg_cfg, "app_voicemail");
-				}
 			}
 
 			break;
@@ -5171,14 +5191,22 @@
 		}
 	}
 
+	if (already_recorded && cmd == -1) {
+		/* Restore original files, if operation cancelled */
+		ast_filerename(backup, msgfile, NULL);
+		if (duration_cstr) {
+			ast_copy_string(duration_str, duration_cstr, sizeof(duration_str));
+		}
+	} else if (prepend_duration) {
+		*duration = prepend_duration;
+		snprintf(duration_str, sizeof(duration_str), "%d", prepend_duration);
+	}
+
+	msg_cat = ast_category_get(msg_cfg, "message");
+	if (!ast_strlen_zero(duration_str) && !ast_variable_update(msg_cat, "duration", duration_str, NULL, 0)) {
+		config_text_file_save(textfile, msg_cfg, "app_voicemail");
+	}
 	ast_config_destroy(msg_cfg);
-	if (already_recorded) {
-		/* Restore original files */
-		ast_filerename(backup, msgfile, NULL);
-		rename(backup_textfile, textfile);
-	}
-	if (prepend_duration)
-		*duration = prepend_duration;
 
 	if (cmd == 't' || cmd == 'S')
 		cmd = 0;
@@ -5263,6 +5291,7 @@
 	int valid_extensions = 0;
 	char *dir;
 	int curmsg;
+	int prompt_played = 0;
 
 	if (vms == NULL) return -1;
 	dir = vms->curdir;
@@ -5344,7 +5373,8 @@
 		} else {
 			/* Ask for an extension */
 			res = ast_streamfile(chan, "vm-extension", chan->language);	/* "extension" */
-			if (res)
+			prompt_played++;
+			if (res || prompt_played > 4)
 				break;
 			if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#") < 0))
 				break;
@@ -5394,19 +5424,15 @@
 	} else {
 		/* Forward VoiceMail */
 		long duration = 0;
-		char origmsgfile[PATH_MAX], msgfile[PATH_MAX];
 		struct vm_state vmstmp;
+#ifndef IMAP_STORAGE
+		char msgfile[PATH_MAX];
+#endif
+		int copy_msg_result = 0;
 
 		memcpy(&vmstmp, vms, sizeof(vmstmp));
 
-		make_file(origmsgfile, sizeof(origmsgfile), dir, curmsg);
-		create_dirpath(vmstmp.curdir, sizeof(vmstmp.curdir), sender->context, vmstmp.username, "tmp");
-		make_file(msgfile, sizeof(msgfile), vmstmp.curdir, curmsg);
-
- 		RETRIEVE(dir, curmsg, sender);
-
-		/* Alter a surrogate file, only */
-		copy_plain_file(origmsgfile, msgfile);
+		RETRIEVE(dir, curmsg, sender);
 
 		cmd = vm_forwardoptions(chan, sender, vmstmp.curdir, curmsg, vmfmts, S_OR(context, "default"), record_gain, &duration, &vmstmp);
 		if (!cmd) {
@@ -5424,7 +5450,7 @@
 					if (!dstvms->mailstream) {
 						ast_log (LOG_ERROR,"IMAP mailstream for %s is NULL\n",vmtmp->mailbox);
 					} else {
-						STORE(vmstmp.curdir, vmtmp->mailbox, vmtmp->context, dstvms->curmsg, chan, vmtmp, fmt, duration, dstvms);
+						copy_msg_result = STORE(vmstmp.curdir, vmtmp->mailbox, vmtmp->context, dstvms->curmsg, chan, vmtmp, fmt, duration, dstvms);
 						run_externnotify(vmtmp->context, vmtmp->mailbox); 
 					}

[... 6253 lines stripped ...]



More information about the asterisk-commits mailing list