[asterisk-commits] oej: branch oej/subscribemwi-1.2 r56614 - in /team/oej/subscribemwi-1.2: ./ a...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Feb 24 09:11:20 MST 2007


Author: oej
Date: Sat Feb 24 10:11:18 2007
New Revision: 56614

URL: http://svn.digium.com/view/asterisk?view=rev&rev=56614
Log:
Trying to reset this branch

Added:
    team/oej/subscribemwi-1.2/channels/misdn/fac.c
      - copied unchanged from r48251, branches/1.2/channels/misdn/fac.c
    team/oej/subscribemwi-1.2/channels/misdn/fac.h
      - copied unchanged from r48251, branches/1.2/channels/misdn/fac.h
    team/oej/subscribemwi-1.2/channels/misdn_config.c
      - copied unchanged from r48251, branches/1.2/channels/misdn_config.c
Removed:
    team/oej/subscribemwi-1.2/channels/chan_misdn_config.c
    team/oej/subscribemwi-1.2/channels/misdn/mISDN.patch
    team/oej/subscribemwi-1.2/channels/misdn/portinfo.c
Modified:
    team/oej/subscribemwi-1.2/   (props changed)
    team/oej/subscribemwi-1.2/.cleancount
    team/oej/subscribemwi-1.2/CREDITS
    team/oej/subscribemwi-1.2/LICENSE
    team/oej/subscribemwi-1.2/Makefile
    team/oej/subscribemwi-1.2/acl.c
    team/oej/subscribemwi-1.2/app.c
    team/oej/subscribemwi-1.2/apps/app_alarmreceiver.c
    team/oej/subscribemwi-1.2/apps/app_authenticate.c
    team/oej/subscribemwi-1.2/apps/app_chanspy.c
    team/oej/subscribemwi-1.2/apps/app_curl.c
    team/oej/subscribemwi-1.2/apps/app_cut.c
    team/oej/subscribemwi-1.2/apps/app_db.c
    team/oej/subscribemwi-1.2/apps/app_dial.c
    team/oej/subscribemwi-1.2/apps/app_directory.c
    team/oej/subscribemwi-1.2/apps/app_dumpchan.c
    team/oej/subscribemwi-1.2/apps/app_externalivr.c
    team/oej/subscribemwi-1.2/apps/app_festival.c
    team/oej/subscribemwi-1.2/apps/app_hasnewvoicemail.c
    team/oej/subscribemwi-1.2/apps/app_ices.c
    team/oej/subscribemwi-1.2/apps/app_macro.c
    team/oej/subscribemwi-1.2/apps/app_math.c
    team/oej/subscribemwi-1.2/apps/app_meetme.c
    team/oej/subscribemwi-1.2/apps/app_mixmonitor.c
    team/oej/subscribemwi-1.2/apps/app_page.c
    team/oej/subscribemwi-1.2/apps/app_playback.c
    team/oej/subscribemwi-1.2/apps/app_queue.c
    team/oej/subscribemwi-1.2/apps/app_random.c
    team/oej/subscribemwi-1.2/apps/app_record.c
    team/oej/subscribemwi-1.2/apps/app_rpt.c
    team/oej/subscribemwi-1.2/apps/app_sms.c
    team/oej/subscribemwi-1.2/apps/app_sql_postgres.c
    team/oej/subscribemwi-1.2/apps/app_test.c
    team/oej/subscribemwi-1.2/apps/app_url.c
    team/oej/subscribemwi-1.2/apps/app_voicemail.c
    team/oej/subscribemwi-1.2/apps/app_waitforsilence.c
    team/oej/subscribemwi-1.2/apps/app_zapbarge.c
    team/oej/subscribemwi-1.2/apps/app_zapras.c
    team/oej/subscribemwi-1.2/apps/app_zapscan.c
    team/oej/subscribemwi-1.2/asterisk.c
    team/oej/subscribemwi-1.2/callerid.c
    team/oej/subscribemwi-1.2/cdr.c
    team/oej/subscribemwi-1.2/cdr/Makefile
    team/oej/subscribemwi-1.2/cdr/cdr_odbc.c
    team/oej/subscribemwi-1.2/cdr/cdr_pgsql.c
    team/oej/subscribemwi-1.2/cdr/cdr_tds.c
    team/oej/subscribemwi-1.2/channel.c
    team/oej/subscribemwi-1.2/channels/Makefile
    team/oej/subscribemwi-1.2/channels/chan_agent.c
    team/oej/subscribemwi-1.2/channels/chan_features.c
    team/oej/subscribemwi-1.2/channels/chan_h323.c
    team/oej/subscribemwi-1.2/channels/chan_iax2.c
    team/oej/subscribemwi-1.2/channels/chan_local.c
    team/oej/subscribemwi-1.2/channels/chan_mgcp.c
    team/oej/subscribemwi-1.2/channels/chan_misdn.c
    team/oej/subscribemwi-1.2/channels/chan_modem.c
    team/oej/subscribemwi-1.2/channels/chan_oss.c
    team/oej/subscribemwi-1.2/channels/chan_phone.c
    team/oej/subscribemwi-1.2/channels/chan_sip.c
    team/oej/subscribemwi-1.2/channels/chan_skinny.c
    team/oej/subscribemwi-1.2/channels/chan_vpb.c
    team/oej/subscribemwi-1.2/channels/chan_zap.c
    team/oej/subscribemwi-1.2/channels/iax2-provision.c
    team/oej/subscribemwi-1.2/channels/misdn/   (props changed)
    team/oej/subscribemwi-1.2/channels/misdn/Makefile
    team/oej/subscribemwi-1.2/channels/misdn/chan_misdn_config.h
    team/oej/subscribemwi-1.2/channels/misdn/ie.c
    team/oej/subscribemwi-1.2/channels/misdn/isdn_lib.c
    team/oej/subscribemwi-1.2/channels/misdn/isdn_lib.h
    team/oej/subscribemwi-1.2/channels/misdn/isdn_lib_intern.h
    team/oej/subscribemwi-1.2/channels/misdn/isdn_msg_parser.c
    team/oej/subscribemwi-1.2/cli.c
    team/oej/subscribemwi-1.2/codecs/gsm/Makefile
    team/oej/subscribemwi-1.2/config.c
    team/oej/subscribemwi-1.2/configs/alsa.conf.sample
    team/oej/subscribemwi-1.2/configs/cdr.conf.sample
    team/oej/subscribemwi-1.2/configs/dundi.conf.sample
    team/oej/subscribemwi-1.2/configs/enum.conf.sample
    team/oej/subscribemwi-1.2/configs/extensions.conf.sample
    team/oej/subscribemwi-1.2/configs/features.conf.sample
    team/oej/subscribemwi-1.2/configs/iax.conf.sample
    team/oej/subscribemwi-1.2/configs/indications.conf.sample
    team/oej/subscribemwi-1.2/configs/misdn.conf.sample
    team/oej/subscribemwi-1.2/configs/osp.conf.sample
    team/oej/subscribemwi-1.2/configs/phone.conf.sample
    team/oej/subscribemwi-1.2/configs/queues.conf.sample
    team/oej/subscribemwi-1.2/configs/sip.conf.sample
    team/oej/subscribemwi-1.2/configs/skinny.conf.sample
    team/oej/subscribemwi-1.2/configs/voicemail.conf.sample
    team/oej/subscribemwi-1.2/configs/vpb.conf.sample
    team/oej/subscribemwi-1.2/configs/zapata.conf.sample
    team/oej/subscribemwi-1.2/contrib/init.d/rc.mandrake.zaptel
    team/oej/subscribemwi-1.2/contrib/init.d/rc.redhat.asterisk
    team/oej/subscribemwi-1.2/contrib/scripts/astgenkey.8
    team/oej/subscribemwi-1.2/dnsmgr.c
    team/oej/subscribemwi-1.2/doc/README.cdr
    team/oej/subscribemwi-1.2/doc/README.enum
    team/oej/subscribemwi-1.2/doc/README.misdn
    team/oej/subscribemwi-1.2/doc/README.variables
    team/oej/subscribemwi-1.2/dsp.c
    team/oej/subscribemwi-1.2/enum.c
    team/oej/subscribemwi-1.2/file.c
    team/oej/subscribemwi-1.2/formats/format_h263.c
    team/oej/subscribemwi-1.2/frame.c
    team/oej/subscribemwi-1.2/funcs/func_cdr.c
    team/oej/subscribemwi-1.2/funcs/func_db.c
    team/oej/subscribemwi-1.2/funcs/func_timeout.c
    team/oej/subscribemwi-1.2/include/asterisk/channel.h
    team/oej/subscribemwi-1.2/include/asterisk/chanspy.h
    team/oej/subscribemwi-1.2/include/asterisk/config.h
    team/oej/subscribemwi-1.2/include/asterisk/linkedlists.h
    team/oej/subscribemwi-1.2/include/asterisk/lock.h
    team/oej/subscribemwi-1.2/include/asterisk/logger.h
    team/oej/subscribemwi-1.2/include/asterisk/plc.h
    team/oej/subscribemwi-1.2/include/asterisk/rtp.h
    team/oej/subscribemwi-1.2/include/asterisk/utils.h
    team/oej/subscribemwi-1.2/io.c
    team/oej/subscribemwi-1.2/jitterbuf.c
    team/oej/subscribemwi-1.2/logger.c
    team/oej/subscribemwi-1.2/netsock.c
    team/oej/subscribemwi-1.2/pbx.c
    team/oej/subscribemwi-1.2/pbx/pbx_ael.c
    team/oej/subscribemwi-1.2/pbx/pbx_config.c
    team/oej/subscribemwi-1.2/pbx/pbx_gtkconsole.c
    team/oej/subscribemwi-1.2/pbx/pbx_spool.c
    team/oej/subscribemwi-1.2/plc.c
    team/oej/subscribemwi-1.2/res/res_agi.c
    team/oej/subscribemwi-1.2/res/res_config_odbc.c
    team/oej/subscribemwi-1.2/res/res_features.c
    team/oej/subscribemwi-1.2/res/res_monitor.c
    team/oej/subscribemwi-1.2/res/res_musiconhold.c
    team/oej/subscribemwi-1.2/res/res_odbc.c
    team/oej/subscribemwi-1.2/rtp.c
    team/oej/subscribemwi-1.2/utils.c
    team/oej/subscribemwi-1.2/utils/smsq.c

Propchange: team/oej/subscribemwi-1.2/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/subscribemwi-1.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Feb 24 10:11:18 2007
@@ -1,1 +1,1 @@
-/branches/1.2:1-28779
+/branches/1.2:1-48264

Modified: team/oej/subscribemwi-1.2/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/.cleancount?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/.cleancount (original)
+++ team/oej/subscribemwi-1.2/.cleancount Sat Feb 24 10:11:18 2007
@@ -1,1 +1,1 @@
-8
+9

Modified: team/oej/subscribemwi-1.2/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/CREDITS?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/CREDITS (original)
+++ team/oej/subscribemwi-1.2/CREDITS Sat Feb 24 10:11:18 2007
@@ -33,6 +33,14 @@
 Russell Bryant - Asterisk 1.0 maintainer and misc. enhancements
 	russelb at clemson.edu
 Anthony Minessale II - Countless big and small fixes, and relentless forward push
+	ChanSpy, ForkCDR, ControlPlayback, While/EndWhile, DumpChan, Dictate,
+	MacroIf, ExecIf, ExecIfTime, RetryDial, MixMonitor applications; res_odbc;
+	many realtime concepts and implementation pieces, including res_config_odbc;
+	format_slin; cdr_custom; several features in Dial including L(), G() and
+	enhancements to M() and D(); several CDR enhancements including CDR variables;
+	attended transfer; one touch record; native MOH; manager eventmask; command
+	line '-t' flag to allow recording/voicemail on nfs shares; #exec command and
+	multiline comments in config files; setvar in iax and sip configs.
 	anthmct at yahoo.com              http://www.asterlink.com
 James Golovich - Innumerable contributions
 	You can find him and asterisk-perl at http://asterisk.gnuinter.net

Modified: team/oej/subscribemwi-1.2/LICENSE
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/LICENSE?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/LICENSE (original)
+++ team/oej/subscribemwi-1.2/LICENSE Sat Feb 24 10:11:18 2007
@@ -4,6 +4,18 @@
 applies to all loadable Asterisk modules used on your system as well,
 except as defined below. The GPL (version 2) is included in this
 source tree in the file COPYING.
+
+This package also includes various components that are not part of
+Asterisk itself; these components are in the 'contrib' directory
+and its subdirectories. Most of these components are also
+distributed under the GPL version 2 as well, except for the following:
+
+contrib/firmware/iax/iaxy.bin:
+	This file is Copyright (C) Digium, Inc. and is licensed for
+	use with Digium IAXy hardware devices only. It can be
+	distributed freely as long as the distribution is in the
+	original form present in this package (not reformatted or
+	modified).
 
 Digium, Inc. (formerly Linux Support Services) holds copyright
 and/or sufficient licenses to all components of the Asterisk

Modified: team/oej/subscribemwi-1.2/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/Makefile?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/Makefile (original)
+++ team/oej/subscribemwi-1.2/Makefile Sat Feb 24 10:11:18 2007
@@ -28,6 +28,7 @@
 ifeq ($(CROSS_COMPILE),)
   OSARCH=$(shell uname -s)
   OSREV=$(shell uname -r)
+  OSCPU=$(shell uname -m)
 else
   OSARCH=$(CROSS_ARCH)
   OSREV=$(CROSS_REV)
@@ -82,6 +83,8 @@
 #   *CLI> show memory summary [filename]
 #
 MALLOC_DEBUG = #-include $(PWD)/include/asterisk/astmm.h
+
+INSTALL=install
 
 # Where to install asterisk after compiling
 # Default -> leave empty
@@ -211,12 +214,15 @@
 endif
 
 GREP=grep
+LN=ln
 ID=id
 
 ifeq ($(OSARCH),SunOS)
   GREP=/usr/xpg4/bin/grep
   M4=/usr/local/bin/m4
   ID=/usr/xpg4/bin/id
+  LN=/usr/xpg4/bin/ln
+  INSTALL=ginstall
 endif
 
 INCLUDE+=-Iinclude -I../include
@@ -283,7 +289,10 @@
 
 ifeq ($(OSARCH),SunOS)
   ASTCFLAGS+=-Wcast-align -DSOLARIS
-  INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
+  INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/opt/ssl/include -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
+  ifeq ($(OSCPU),sun4u)
+    OPTIMIZE+=-mcpu=v9 -mcpu=ultrasparc
+  endif
 endif
 
 ifeq ($(findstring CYGWIN,$(OSARCH)),CYGWIN)
@@ -360,7 +369,11 @@
 ifeq ($(OSARCH),Linux)
   LIBS+=-ldl -lpthread -lncurses -lm -lresolv  #-lnjamd
 else
-  LIBS+=-lncurses -lm
+  ifeq ($(OSARCH),SunOS)
+    LIBS+=-lm -lcurses
+  else
+    LIBS+=-lncurses -lm
+  endif
 endif
 
 ifeq ($(OSARCH),Darwin)
@@ -390,10 +403,10 @@
 endif
 
 ifeq ($(OSARCH),SunOS)
-  LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
+  LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/opt/ssl/lib -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
   OBJS+=strcompat.o
   ASTLINK=
-  SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
+  SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/opt/ssl/lib -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
 endif
 
 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
@@ -408,8 +421,6 @@
 endif
 
 LIBS+=-lssl
-
-INSTALL=install
 
 _all: all
 	@echo " +--------- Asterisk Build Complete ---------+"  
@@ -578,7 +589,7 @@
 			exit 1; \
 		fi; \
 	done
-	for x in sounds/demo-* sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-* sounds/spy-* sounds/priv-* sounds/screen-* sounds/hello-*; do \
+	for x in sounds/demo-* sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-* sounds/spy-* sounds/priv-* sounds/screen-* sounds/hello-* sounds/hours* sounds/minute* sounds/second* ; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
 			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
 		else \
@@ -634,7 +645,7 @@
 	if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
 	if [ -f cygwin/asterisk.exe ]; then $(INSTALL) -m 755 cygwin/asterisk.exe $(DESTDIR)$(ASTSBINDIR)/; fi
 	if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
-	ln -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
+	$(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
 	$(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
 	$(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/	
 	if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \

Modified: team/oej/subscribemwi-1.2/acl.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/acl.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/acl.c (original)
+++ team/oej/subscribemwi-1.2/acl.c Sat Feb 24 10:11:18 2007
@@ -176,12 +176,12 @@
 		} else if (!inet_aton(nm, &ha->netmask)) {
 			ast_log(LOG_WARNING, "%s is not a valid netmask\n", nm);
 			free(ha);
-			return path;
+			return ret;
 		}
 		if (!inet_aton(tmp, &ha->netaddr)) {
 			ast_log(LOG_WARNING, "%s is not a valid IP\n", tmp);
 			free(ha);
-			return path;
+			return ret;
 		}
 		ha->netaddr.s_addr &= ha->netmask.s_addr;
 		if (!strncasecmp(sense, "p", 1)) {

Modified: team/oej/subscribemwi-1.2/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/app.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/app.c (original)
+++ team/oej/subscribemwi-1.2/app.c Sat Feb 24 10:11:18 2007
@@ -1158,7 +1158,7 @@
 	snprintf(fs, strlen(path) + 19, "%s/.lock-%08x", path, rand());
 	fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
 	if (fd < 0) {
-		fprintf(stderr, "Unable to create lock file '%s': %s\n", path, strerror(errno));
+		ast_log(LOG_ERROR, "Unable to create lock file '%s': %s\n", path, strerror(errno));
 		return AST_LOCK_PATH_NOT_FOUND;
 	}
 	close(fd);
@@ -1167,11 +1167,13 @@
 	time(&start);
 	while (((res = link(fs, s)) < 0) && (errno == EEXIST) && (time(NULL) - start < 5))
 		usleep(1);
+
+	unlink(fs);
+
 	if (res) {
 		ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n", path, strerror(errno));
 		return AST_LOCK_TIMEOUT;
 	} else {
-		unlink(fs);
 		ast_log(LOG_DEBUG, "Locked path '%s'\n", path);
 		return AST_LOCK_SUCCESS;
 	}
@@ -1180,12 +1182,22 @@
 int ast_unlock_path(const char *path)
 {
 	char *s;
+	int res;
+
 	s = alloca(strlen(path) + 10);
-	if (!s)
+	if (!s) {
+		ast_log(LOG_WARNING, "Out of memory!\n");
 		return -1;
+	}
+
 	snprintf(s, strlen(path) + 9, "%s/%s", path, ".lock");
-	ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
-	return unlink(s);
+
+	if ((res = unlink(s)))
+		ast_log(LOG_ERROR, "Could not unlock path '%s': %s\n", path, strerror(errno));
+	else
+		ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
+
+	return res;
 }
 
 int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path) 

Modified: team/oej/subscribemwi-1.2/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/apps/app_alarmreceiver.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/apps/app_alarmreceiver.c (original)
+++ team/oej/subscribemwi-1.2/apps/app_alarmreceiver.c Sat Feb 24 10:11:18 2007
@@ -145,7 +145,7 @@
 	res = ast_db_put(db_family, key, value);
 	
 	if((res)&&(option_verbose >= 4))
-		ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: database_increment write error");
+		ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: database_increment write error\n");
 	
 	return;	
 }
@@ -215,6 +215,7 @@
 
 			i += wf.datalen / 8;
 			if (i > duration) {
+				ast_frfree(f);
 				break;
 			}
 			if (ast_write(chan, &wf)){
@@ -222,6 +223,7 @@
 					ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Failed to write frame on %s\n", chan->name);
 				ast_log(LOG_WARNING, "AlarmReceiver Failed to write frame on %s\n",chan->name);
 				res = -1;
+				ast_frfree(f);
 				break;
 			}
 		}

Modified: team/oej/subscribemwi-1.2/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/apps/app_authenticate.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/apps/app_authenticate.c (original)
+++ team/oej/subscribemwi-1.2/apps/app_authenticate.c Sat Feb 24 10:11:18 2007
@@ -186,7 +186,7 @@
 		if (!res)
 			res = ast_waitstream(chan, "");
 	} else {
-		if (jump && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
+		if (jump && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101) == 0) {
 			res = 0;
 		} else {
 			if (!ast_streamfile(chan, "vm-goodbye", chan->language))

Modified: team/oej/subscribemwi-1.2/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/apps/app_chanspy.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/apps/app_chanspy.c (original)
+++ team/oej/subscribemwi-1.2/apps/app_chanspy.c Sat Feb 24 10:11:18 2007
@@ -3,7 +3,8 @@
  *
  * Copyright (C) 2005 Anthony Minessale II (anthmct at yahoo.com)
  *
- * Disclaimed to Digium
+ * A license has been granted to Digium (via disclaimer) for the use of
+ * this code.
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -130,7 +131,7 @@
 	ast_mutex_lock(&modlock);
 	chan = local_channel_walk(NULL);
 	while (chan) {
-		if (!strncmp(chan->name, name, strlen(name))) {
+		if (!strncmp(chan->name, name, strlen(name)) && strncmp(chan->name, "Zap/pseudo", 10)) {
 			ret = chan;
 			break;
 		}
@@ -205,21 +206,6 @@
 
 	return res;
 }
-
-static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy) 
-{
-	/* If our status has changed to DONE, then the channel we're spying on is gone....
-	   DON'T TOUCH IT!!!  RUN AWAY!!! */
-	if (spy->status == CHANSPY_DONE)
-		return;
-
-	if (!chan)
-		return;
-
-	ast_mutex_lock(&chan->lock);
-	ast_channel_spy_remove(chan, spy);
-	ast_mutex_unlock(&chan->lock);
-};
 
 /* Map 'volume' levels from -4 through +4 into
    decibel (dB) settings for channel drivers
@@ -251,102 +237,111 @@
 static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int *volfactor, int fd) 
 {
 	struct chanspy_translation_helper csth;
-	int running, res = 0, x = 0;
-	char inp[24];
-	char *name=NULL;
-	struct ast_frame *f;
-
-	running = (chan && !ast_check_hangup(chan) && spyee && !ast_check_hangup(spyee));
-
-	if (running) {
-		memset(inp, 0, sizeof(inp));
-		name = ast_strdupa(spyee->name);
-		if (option_verbose >= 2)
-			ast_verbose(VERBOSE_PREFIX_2 "Spying on channel %s\n", name);
-
-		memset(&csth, 0, sizeof(csth));
-		ast_set_flag(&csth.spy, CHANSPY_FORMAT_AUDIO);
-		ast_set_flag(&csth.spy, CHANSPY_TRIGGER_NONE);
-		ast_set_flag(&csth.spy, CHANSPY_MIXAUDIO);
-		csth.spy.type = chanspy_spy_type;
-		csth.spy.status = CHANSPY_RUNNING;
-		csth.spy.read_queue.format = AST_FORMAT_SLINEAR;
-		csth.spy.write_queue.format = AST_FORMAT_SLINEAR;
-		ast_mutex_init(&csth.spy.lock);
-		csth.volfactor = *volfactor;
-		set_volume(chan, &csth);
+	int running = 0, res = 0, x = 0;
+	char inp[24] = "", *name = NULL;
+	struct ast_frame *f = NULL;
+
+	if ((chan && ast_check_hangup(chan)) || (spyee && ast_check_hangup(spyee)))
+		return 0;
+
+	name = ast_strdupa(spyee->name);
+	if (option_verbose > 1)
+		ast_verbose(VERBOSE_PREFIX_2 "Spying on channel %s\n", name);
+
+	memset(&csth, 0, sizeof(csth));
+	ast_set_flag(&csth.spy, CHANSPY_FORMAT_AUDIO);
+	ast_set_flag(&csth.spy, CHANSPY_TRIGGER_NONE);
+	ast_set_flag(&csth.spy, CHANSPY_MIXAUDIO);
+	csth.spy.type = chanspy_spy_type;
+	csth.spy.status = CHANSPY_RUNNING;
+	csth.spy.read_queue.format = AST_FORMAT_SLINEAR;
+	csth.spy.write_queue.format = AST_FORMAT_SLINEAR;
+	ast_mutex_init(&csth.spy.lock);
+	csth.volfactor = *volfactor;
+	set_volume(chan, &csth);
+	if (csth.volfactor) {
+		ast_set_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
 		csth.spy.read_vol_adjustment = csth.volfactor;
+		ast_set_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
 		csth.spy.write_vol_adjustment = csth.volfactor;
-		csth.fd = fd;
-
-		if (start_spying(spyee, chan, &csth.spy))
-			running = 0;
-	}
-
-	if (running) {
-		running = 1;
-		ast_activate_generator(chan, &spygen, &csth);
-
-		while (csth.spy.status == CHANSPY_RUNNING &&
-		       chan && !ast_check_hangup(chan) &&
-		       spyee &&
-		       !ast_check_hangup(spyee) &&
-		       running == 1 &&
-		       (res = ast_waitfor(chan, -1) > -1)) {
-			if ((f = ast_read(chan))) {
-				res = 0;
-				if (f->frametype == AST_FRAME_DTMF) {
-					res = f->subclass;
+	}
+	csth.fd = fd;
+
+	if (start_spying(spyee, chan, &csth.spy)) {
+		ast_channel_spy_free(&csth.spy);
+		return 0;
+	}
+
+	ast_activate_generator(chan, &spygen, &csth);
+
+	while (csth.spy.status == CHANSPY_RUNNING &&
+	       (res = ast_waitfor(chan, -1) > -1)) {
+		
+		/* Read in frame from channel, break out if no frame */
+		if (!(f = ast_read(chan)))
+			break;
+		
+		/* Now if this is DTMF then we have to handle it as such, otherwise just skip it */
+		res = 0;
+		if (f->frametype == AST_FRAME_DTMF)
+			res = f->subclass;
+		ast_frfree(f);
+		if (!res)
+			continue;
+		
+		if (x == sizeof(inp))
+			x = 0;
+		
+		if (res < 0) {
+			running = -1;
+			break;
+		}
+		
+		/* Process DTMF digits */
+		if (res == '#') {
+			if (!ast_strlen_zero(inp)) {
+				running = x ? atoi(inp) : -1;
+				break;
+			} else {
+				(*volfactor)++;
+				if (*volfactor > 4)
+					*volfactor = -1;
+				if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "Setting spy volume on %s to %d\n", chan->name, *volfactor);
+				csth.volfactor = *volfactor;
+				set_volume(chan, &csth);
+				if (csth.volfactor) {
+					ast_set_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
+					csth.spy.read_vol_adjustment = csth.volfactor;
+					ast_set_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
+					csth.spy.write_vol_adjustment = csth.volfactor;
+				} else {
+					ast_clear_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
+					ast_clear_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
 				}
-				ast_frfree(f);
-				if (!res) {
-					continue;
-				}
-			} else {
-				break;
 			}
-			if (x == sizeof(inp)) {
-				x = 0;
-			}
-			if (res < 0) {
-				running = -1;
-			}
-			if (res == 0) {
-				continue;
-			} else if (res == '*') {
-				running = 0; 
-			} else if (res == '#') {
-				if (!ast_strlen_zero(inp)) {
-					running = x ? atoi(inp) : -1;
-					break;
-				} else {
-					(*volfactor)++;
-					if (*volfactor > 4) {
-						*volfactor = -4;
-					}
-					if (option_verbose > 2) {
-						ast_verbose(VERBOSE_PREFIX_3 "Setting spy volume on %s to %d\n", chan->name, *volfactor);
-					}
-					csth.volfactor = *volfactor;
-					set_volume(chan, &csth);
-					csth.spy.read_vol_adjustment = csth.volfactor;
-					csth.spy.write_vol_adjustment = csth.volfactor;
-				}
-			} else if (res >= 48 && res <= 57) {
-				inp[x++] = res;
-			}
-		}
-		ast_deactivate_generator(chan);
-		stop_spying(spyee, &csth.spy);
-
-		if (option_verbose >= 2) {
-			ast_verbose(VERBOSE_PREFIX_2 "Done Spying on channel %s\n", name);
-		}
-	} else {
-		running = 0;
-	}
-
-	ast_mutex_destroy(&csth.spy.lock);
+		} else if (res == '*') {
+			break;
+		} else if (res >= 48 && res <= 57) {
+			inp[x++] = res;
+		}
+	}
+
+	ast_deactivate_generator(chan);
+	
+	ast_mutex_lock(&csth.spy.lock);
+	if (csth.spy.chan) {
+		csth.spy.status = CHANSPY_DONE;
+		ast_mutex_lock(&csth.spy.chan->lock);
+		ast_channel_spy_remove(csth.spy.chan, &csth.spy);
+		ast_mutex_unlock(&csth.spy.chan->lock);
+	}
+	ast_mutex_unlock(&csth.spy.lock);
+
+	if (option_verbose > 1)
+		ast_verbose(VERBOSE_PREFIX_2 "Done Spying on channel %s\n", name);
+
+	ast_channel_spy_free(&csth.spy);
 
 	return running;
 }
@@ -418,19 +413,19 @@
 		char *opts[OPT_ARG_ARRAY_SIZE];
 		ast_app_parse_options(chanspy_opts, &flags, opts, options);
 		if (ast_test_flag(&flags, OPTION_GROUP)) {
-			mygroup = opts[1];
+			mygroup = opts[OPT_ARG_GROUP];
 		}
 		if (ast_test_flag(&flags, OPTION_RECORD)) {
-			if (!(recbase = opts[2])) {
+			if (!(recbase = opts[OPT_ARG_RECORD])) {
 				recbase = "chanspy";
 			}
 		}
 		silent = ast_test_flag(&flags, OPTION_QUIET);
 		bronly = ast_test_flag(&flags, OPTION_BRIDGED);
-		if (ast_test_flag(&flags, OPTION_VOLUME) && opts[1]) {
+		if (ast_test_flag(&flags, OPTION_VOLUME) && opts[OPT_ARG_VOLUME]) {
 			int vol;
 
-			if ((sscanf(opts[0], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
+			if ((sscanf(opts[OPT_ARG_VOLUME], "%d", &vol) != 1) || (vol > 4) || (vol < -4))
 				ast_log(LOG_NOTICE, "Volume factor must be a number between -4 and 4\n");
 			else
 				volfactor = vol;

Modified: team/oej/subscribemwi-1.2/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/apps/app_curl.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/apps/app_curl.c (original)
+++ team/oej/subscribemwi-1.2/apps/app_curl.c Sat Feb 24 10:11:18 2007
@@ -94,7 +94,6 @@
 {
 	CURL *curl;
 
-	curl_global_init(CURL_GLOBAL_ALL);
 	curl = curl_easy_init();
 
 	if (!curl) {
@@ -224,6 +223,7 @@
 	res |= ast_unregister_application(app);
 
 	STANDARD_HANGUP_LOCALUSERS;
+	curl_global_cleanup();
 	
 	return res;
 }
@@ -232,6 +232,7 @@
 {
 	int res;
 
+	curl_global_init(CURL_GLOBAL_ALL);
 	res = ast_custom_function_register(&acf_curl);
 	res |= ast_register_application(app, curl_exec, synopsis, descrip);
 

Modified: team/oej/subscribemwi-1.2/apps/app_cut.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/apps/app_cut.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/apps/app_cut.c (original)
+++ team/oej/subscribemwi-1.2/apps/app_cut.c Sat Feb 24 10:11:18 2007
@@ -48,7 +48,7 @@
 static char *cut_synopsis = "Splits a variable's contents using the specified delimiter";
 
 static char *cut_descrip =
-"  Cut(newvar=varname,delimiter,fieldspec): This applicaiton will split the\n"
+"  Cut(newvar=varname,delimiter,fieldspec): This application will split the\n"
 "contents of a variable based on the given delimeter and store the result in\n"
 "a new variable.\n"
 "Parameters:\n"
@@ -66,7 +66,7 @@
 "  Sort(newvar=key1:val1[,key2:val2[[...],keyN:valN]]): This application will\n"
 "sort the list provided in ascending order. The result will be stored in the\n"
 "specified variable name.\n"
-"  This applicaiton has been deprecated in favor of the SORT function.\n";
+"  This application has been deprecated in favor of the SORT function.\n";
 
 STANDARD_LOCAL_USER;
 

Modified: team/oej/subscribemwi-1.2/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/apps/app_db.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/apps/app_db.c (original)
+++ team/oej/subscribemwi-1.2/apps/app_db.c Sat Feb 24 10:11:18 2007
@@ -63,7 +63,7 @@
 "  This application has been deprecated in favor of the DB function.\n";
 
 static char *d_descrip =
-"  DBdel(family/key): This applicaiton will delete a key from the Asterisk\n"
+"  DBdel(family/key): This application will delete a key from the Asterisk\n"
 "database.\n";
 
 static char *dt_descrip =

Modified: team/oej/subscribemwi-1.2/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/apps/app_dial.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/apps/app_dial.c (original)
+++ team/oej/subscribemwi-1.2/apps/app_dial.c Sat Feb 24 10:11:18 2007
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <sys/time.h>
 #include <sys/signal.h>
+#include <sys/stat.h>
 #include <netinet/in.h>
 
 #include "asterisk.h"
@@ -64,7 +65,7 @@
 
 static char *descrip =
 "  Dial(Technology/resource[&Tech2/resource2...][|timeout][|options][|URL]):\n"
-"This applicaiton will place calls to one or more specified channels. As soon\n"
+"This application will place calls to one or more specified channels. As soon\n"
 "as one of the requested channels answers, the originating channel will be\n"
 "answered, if it has not already been answered. These two channels will then\n"
 "be active in a bridged call. All other channels that were requested will then\n"
@@ -939,27 +940,39 @@
 		}
 		
 		if( privdb_val == AST_PRIVACY_DENY ) {
+			strcpy(status, "NOANSWER");
 			ast_verbose( VERBOSE_PREFIX_3  "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
 			res=0;
 			goto out;
 		}
 		else if( privdb_val == AST_PRIVACY_KILL ) {
-			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+			strcpy(status, "DONTCALL");
+			if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
+				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+			}
 			res = 0;
 			goto out; /* Is this right? */
 		}
 		else if( privdb_val == AST_PRIVACY_TORTURE ) {
-			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+			strcpy(status, "TORTURE");
+			if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
+				ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+			}
 			res = 0;
 			goto out; /* is this right??? */
-
 		}
 		else if( privdb_val == AST_PRIVACY_UNKNOWN ) {
 			/* Get the user's intro, store it in priv-callerintros/$CID, 
 			   unless it is already there-- this should be done before the 
 			   call is actually dialed  */
 
-			/* make sure the priv-callerintros dir exists? */
+			/* make sure the priv-callerintros dir actually exists */
+			snprintf(privintro, sizeof(privintro), "%s/sounds/priv-callerintros", ast_config_AST_VAR_DIR);
+			if (mkdir(privintro, 0755) && errno != EEXIST) {
+				ast_log(LOG_WARNING, "privacy: can't create directory priv-callerintros: %s\n", strerror(errno));
+				res = -1;
+				goto out;
+			}
 
 			snprintf(privintro,sizeof(privintro),"priv-callerintros/%s", privcid);
 			if( ast_fileexists(privintro,NULL,NULL ) > 0 && strncmp(privcid,"NOCALLERID",10) != 0) {
@@ -976,9 +989,18 @@
 				   "At the tone, please say your name:"
 
 				*/
-				ast_play_and_record(chan, "priv-recordintro", privintro, 4, "gsm", &duration, 128, 2000, 0);  /* NOTE: I've reduced the total time to 4 sec */
-															/* don't think we'll need a lock removed, we took care of
-															   conflicts by naming the privintro file */
+				res = ast_play_and_record(chan, "priv-recordintro", privintro, 4, "gsm", &duration, 128, 2000, 0);  /* NOTE: I've reduced the total time to */
+															/* 4 sec don't think we'll need a lock removed, we 
+															   took care of conflicts by naming the privintro file */
+				if (res == -1) {
+					/* Delete the file regardless since they hung up during recording */
+                                        ast_filedelete(privintro, NULL);
+                                        if( ast_fileexists(privintro,NULL,NULL ) > 0 )
+                                                ast_log(LOG_NOTICE,"privacy: ast_filedelete didn't do its job on %s\n", privintro);
+                                        else if (option_verbose > 2)
+                                                ast_verbose( VERBOSE_PREFIX_3 "Successfully deleted %s intro file\n", privintro);
+					goto out;
+				}
 			}
 		}
 	}
@@ -1136,7 +1158,7 @@
 			/* Again, keep going even if there's an error */
 			if (option_debug)
 				ast_log(LOG_DEBUG, "ast call on peer returned %d\n", res);
-			else if (option_verbose > 2)
+			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Couldn't call %s\n", numsubst);
 			ast_hangup(tmp->chan);
 			tmp->chan = NULL;
@@ -1175,6 +1197,7 @@
 		strcpy(status, "NOANSWER");
 		if (ast_test_flag(outgoing, OPT_MUSICBACK)) {
 			moh=1;
+			ast_indicate(chan, AST_CONTROL_PROGRESS);
 			ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK]);
 		} else if (ast_test_flag(outgoing, OPT_RINGBACK)) {
 			ast_indicate(chan, AST_CONTROL_RINGING);
@@ -1252,18 +1275,18 @@
 					do {
 						if (!res2)
 							res2 = ast_play_and_wait(peer,"priv-callpending");
-						if( res2 < '1' || (ast_test_flag(&opts, OPT_PRIVACY) && res2>'5') || (ast_test_flag(&opts, OPT_SCREENING) && res2 > '4') ) /* uh, interrupting with a bad answer is ... ignorable! */
+						if ( res2 < '1' || (ast_test_flag(&opts, OPT_PRIVACY) && res2>'5') || (ast_test_flag(&opts, OPT_SCREENING) && res2 > '4') ) /* uh, interrupting with a bad answer is ... ignorable! */
 							res2 = 0;
 						
 						/* priv-callpending script: 
 						   "I have a caller waiting, who introduces themselves as:"
 						*/
 						if (!res2)
-							res2 = ast_play_and_wait(peer,privintro);
-						if( res2 < '1' || (ast_test_flag(&opts, OPT_PRIVACY) && res2>'5') || (ast_test_flag(&opts, OPT_SCREENING) && res2 > '4') ) /* uh, interrupting with a bad answer is ... ignorable! */
+							res2 = ast_play_and_wait(peer, privintro);
+						if ( res2 < '1' || (ast_test_flag(&opts, OPT_PRIVACY) && res2>'5') || (ast_test_flag(&opts, OPT_SCREENING) && res2 > '4') ) /* uh, interrupting with a bad answer is ... ignorable! */
 							res2 = 0;
 						/* now get input from the called party, as to their choice */
-						if( !res2 ) {
+						if (!res2) {
 							if( ast_test_flag(&opts, OPT_PRIVACY) )
 								res2 = ast_play_and_wait(peer,"priv-callee-options");
 							if( ast_test_flag(&opts, OPT_SCREENING) )
@@ -1310,6 +1333,7 @@
 								     opt_args[OPT_ARG_PRIVACY], privcid);
 						ast_privacy_set(opt_args[OPT_ARG_PRIVACY], privcid, AST_PRIVACY_DENY);
 					}
+					strcpy(status,"NOANSWER");
 					if (ast_test_flag(&opts, OPT_MUSICBACK)) {
 						ast_moh_stop(chan);
 					} else if (ast_test_flag(&opts, OPT_RINGBACK)) {

Modified: team/oej/subscribemwi-1.2/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi-1.2/apps/app_directory.c?view=diff&rev=56614&r1=56613&r2=56614
==============================================================================
--- team/oej/subscribemwi-1.2/apps/app_directory.c (original)
+++ team/oej/subscribemwi-1.2/apps/app_directory.c Sat Feb 24 10:11:18 2007
@@ -42,6 +42,16 @@
 #include "asterisk/say.h"
 #include "asterisk/utils.h"
 
+#ifdef USE_ODBC_STORAGE
+#include <errno.h>
+#include <sys/mman.h>
+#include "asterisk/res_odbc.h"
+
+static char odbc_database[80] = "asterisk";
+static char odbc_table[80] = "voicemessages";
+static char vmfmts[80] = "wav";
+#endif
+
 static char *tdesc = "Extension Directory";
 static char *app = "Directory";
 
@@ -51,7 +61,7 @@
 "the calling channel with a directory of extensions from which they can search\n"
 "by name. The list of names and corresponding extensions is retrieved from the\n"
 "voicemail configuration file, voicemail.conf.\n"
-"  This applicaiton will immediate exit if one of the following DTMF digits are\n"
+"  This application will immediately exit if one of the following DTMF digits are\n"
 "received and the extension to jump to exists:\n"
 "    0 - Jump to the 'o' extension, if it exists.\n"
 "    * - Jump to the 'a' extension, if it exists.\n\n"
@@ -77,6 +87,101 @@
 
 LOCAL_USER_DECL;
 
+#ifdef USE_ODBC_STORAGE
+static void retrieve_file(char *dir)
+{
+	int x = 0;
+	int res;
+	int fd=-1;
+	size_t fdlen = 0;
+	void *fdm=NULL;
+	SQLHSTMT stmt;
+	char sql[256];
+	char fmt[80]="";
+	char *c;
+	SQLLEN colsize;
+	char full_fn[256];
+
+	odbc_obj *obj;
+	obj = fetch_odbc_obj(odbc_database, 0);
+	if (obj) {
+		do {
+			ast_copy_string(fmt, vmfmts, sizeof(fmt));
+			c = strchr(fmt, '|');
+			if (c)
+				*c = '\0';
+			if (!strcasecmp(fmt, "wav49"))
+				strcpy(fmt, "WAV");
+			snprintf(full_fn, sizeof(full_fn), "%s.%s", dir, fmt);
+			res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
+			if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+				ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
+				break;
+			}
+			snprintf(sql, sizeof(sql), "SELECT recording FROM %s WHERE dir=? AND msgnum=-1", odbc_table);
+			res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
+			if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+				ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
+				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+				break;
+			}
+			SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(dir), 0, (void *)dir, 0, NULL);
+			res = odbc_smart_execute(obj, stmt);
+			if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+				ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
+				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+				break;
+			}
+			res = SQLFetch(stmt);
+			if (res == SQL_NO_DATA) {
+				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+				break;
+			} else if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+				ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
+				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+				break;
+			}
+			fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, 0770);
+			if (fd < 0) {
+				ast_log(LOG_WARNING, "Failed to write '%s': %s\n", full_fn, strerror(errno));
+				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+				break;
+			}
+
+			res = SQLGetData(stmt, 1, SQL_BINARY, NULL, 0, &colsize);
+			fdlen = colsize;
+			if (fd > -1) {
+				char tmp[1]="";
+				lseek(fd, fdlen - 1, SEEK_SET);
+				if (write(fd, tmp, 1) != 1) {
+					close(fd);
+					fd = -1;
+					break;
+				}
+				if (fd > -1)
+					fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+			}
+			if (fdm) {
+				memset(fdm, 0, fdlen);
+				res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, fdlen, &colsize);

[... 25253 lines stripped ...]


More information about the asterisk-commits mailing list