Revision
15705
Author
joshrivers
Date
2009-11-28 23:19:09 -0600 (Sat, 28 Nov 2009)

Log Message

Updating branch to HEAD. Hopefully correct merge this time.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/Freeswitch.2008.sln (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/Freeswitch.2008.sln	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/Freeswitch.2008.sln	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1022,6 +1022,9 @@
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unimrcp", "unimrcp", "{62F27B1A-C919-4A70-8478-51F178F3B18F}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aprtoolkit", "libs\unimrcp\libs\apr-toolkit\aprtoolkit.2008.vcproj", "{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}"
+	ProjectSection(ProjectDependencies) = postProject
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpf", "libs\unimrcp\libs\mpf\mpf.2008.vcproj", "{B5A00BFA-6083-4FAE-A097-71642D6473B5}"
 EndProject
@@ -1036,6 +1039,9 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unirtsp", "libs\unimrcp\libs\uni-rtsp\unirtsp.2008.vcproj", "{504B3154-7A4F-459D-9877-B951021C3F1F}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "libs\unimrcp\modules\mrcp-sofiasip\mrcpsofiasip.2008.vcproj", "{746F3632-5BB2-4570-9453-31D6D58A7D8E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
+	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpunirtsp", "libs\unimrcp\modules\mrcp-unirtsp\mrcpunirtsp.2008.vcproj", "{DEB01ACB-D65F-4A62-AED9-58C1054499E9}"
 EndProject

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/Makefile.am (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/Makefile.am	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/Makefile.am	2009-11-29 05:19:09 UTC (rev 15705)
@@ -162,14 +162,14 @@
 libs/libteletone/src/libteletone.h\
 src/include/switch_odbc.h
 
-CORE_CFLAGS     = `$(switch_srcdir)/libs/apr/apr-1-config --cflags --cppflags --includes`
-CORE_CFLAGS    += `$(switch_srcdir)/libs/apr-util/apu-1-config --includes`
+CORE_CFLAGS     = `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes`
+CORE_CFLAGS    += `$(switch_builddir)/libs/apr-util/apu-1-config --includes`
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/stfu
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/sqlite
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/pcre
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/speex/include
+CORE_CFLAGS    += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include
 CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/include
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/crypto/include
+CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
 
 CORE_LIBS      = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la
 CORE_LIBS     += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la
@@ -192,22 +192,22 @@
 fs_cli_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/fs_cli.c
 freeswitch_SOURCES = src/switch.c
 nodist_freeswitch_SOURCES = src/include/switch_version.h
-fs_cli_CFLAGS = $(AM_CFLAGS) -Ilibs/esl/src/include 
+fs_cli_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
 fs_cli_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
-fs_ivrd_CFLAGS = $(AM_CFLAGS) -Ilibs/esl/src/include 
+fs_ivrd_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
 fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
 freeswitch_CFLAGS = $(AM_CFLAGS) $(CORE_CFLAGS)
 freeswitch_LDFLAGS = $(AM_LDFLAGS) -lpthread -rpath $(libdir)
 freeswitch_LDADD = libfreeswitch.la libs/apr/libapr-1.la
 if ADD_LIBEDIT
-fs_cli_CFLAGS += -DHAVE_EDITLINE -Ilibs/libedit/src
+fs_cli_CFLAGS += -DHAVE_EDITLINE -I$(switch_srcdir)/libs/libedit/src
 fs_cli_LDADD = libs/libedit/src/.libs/libedit.a
 freeswitch_CFLAGS    += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT
 freeswitch_LDADD      += libs/libedit/src/.libs/libedit.a
 endif
 
 if ADD_LIBEDIT
-CORE_CFLAGS    += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT
+CORE_CFLAGS    += -I$(switch_srcdir)/libs/libedit/src -DSWITCH_HAVE_LIBEDIT
 CORE_LIBS      += libs/libedit/src/.libs/libedit.a
 endif
 
@@ -222,8 +222,8 @@
 
 bin_SCRIPTS = scripts/gentls_cert scripts/fsxs
 
-src/include/switch_swigable_cpp.h: src/include/switch_cpp.h
-	$(CC) -E src/include/switch_cpp.h -DSWITCH_DECLARE_CLASS= -DSWITCH_DECLARE\(x\)=x -DSWITCH_DECLARE_CONSTRUCTOR= -DSWITCH_DECLARE_NONSTD\(x\)=x 2>/dev/null | grep -v "^#" > src/include/switch_swigable_cpp.h 
+src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h
+	$(CC) -E $(switch_srcdir)/src/include/switch_cpp.h -DSWITCH_DECLARE_CLASS= -DSWITCH_DECLARE\(x\)=x -DSWITCH_DECLARE_CONSTRUCTOR= -DSWITCH_DECLARE_NONSTD\(x\)=x 2>/dev/null | grep -v "^#" > src/include/switch_swigable_cpp.h 
 
 libs/libedit/src/.libs/libedit.a:
 	cd libs/libedit && $(MAKE)
@@ -282,7 +282,7 @@
 .version:
 	touch .version
 
-src/include/switch_version.h: $(top_srcdir)/src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
+src/include/switch_version.h: $(switch_builddir)/src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
 	@have_version=1 ; \
 	force=0 ; \
 	grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null  && have_version=0 ; \
@@ -491,12 +491,12 @@
 	    -e "s,@INSTALL\@,$(INSTALL)," \
 	    -e "s,@MKINSTALLDIRS\@,$(mkdir_p)," \
 	    \
-	    -e "s|@CFLAGS\@|$(CFLAGS) `$(switch_srcdir)/libs/apr/apr-1-config --cflags --cppflags`|" \
+	    -e "s|@CFLAGS\@|$(CFLAGS) `./libs/apr/apr-1-config --cflags --cppflags`|" \
 	    -e "s|@INCLUDES\@|-I$(PREFIX)/include|" \
 	    -e "s|@SOLINK\@|$(SOLINK)|" \
 	    -e "s|@LDFLAGS\@|-L$(PREFIX)/lib|" \
-	    -e "s|@LIBS\@|`$(switch_srcdir)/libs/apr/apr-1-config --libs` `$(switch_srcdir)/libs/apr-util/apu-1-config --libs`|" \
-	    scripts/fsxs.in > scripts/fsxs
+	    -e "s|@LIBS\@|`./libs/apr/apr-1-config --libs` `./libs/apr-util/apu-1-config --libs`|" \
+	    $(top_srcdir)/scripts/fsxs.in > scripts/fsxs
 
 eclean: clean
 	rm -f `find . -type f -name \*~`

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/build/modmake.rules.in (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/build/modmake.rules.in	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/build/modmake.rules.in	2009-11-29 05:19:09 UTC (rev 15705)
@@ -20,7 +20,7 @@
 LIBCURL=@LIBCURL@
 LIBCURL_CPPFLAGS=@LIBCURL_CPPFLAGS@
 CURL_DIR=$(switch_srcdir)/libs/curl
-CURLLA=$(CURL_DIR)/lib/libcurl.la
+CURLLA=$(switch_builddir)/libs/curl/lib/libcurl.la
 
 OPENSSL_LIBS=@openssl_LIBS@
 OPENSSL_CFLAGS=@openssl_CFLAGS@
@@ -50,14 +50,14 @@
 LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXXCOMPILE)
 CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
 
-CSOURCEFILE=$(MODNAME).c
-CXXSOURCEFILE=$(MODNAME).cpp
+CSOURCEFILE=$(MODDIR)/$(MODNAME).c
+CXXSOURCEFILE=$(MODDIR)/$(MODNAME).cpp
 TOUCH_TARGET=@TOUCH_TARGET@
 
 #MAKE_OPTS = `if test -z "$(VERBOSE)" ; then $(MAKE) --help | grep silent | grep "\-s" 2>&1 >/dev/null && echo -s;fi`
 MAKE_OPTS = `test -n "$(VERBOSE)" || echo -s`
 RECURSE_MODNAME=`pwd | sed -e 's|^.*/||'`
-RECURSE_SOURCEFILE=`if test -f $$modname.cpp; then echo $$modname.cpp; else echo $$modname.c; fi`
+RECURSE_SOURCEFILE=`if test -f "$(MODDIR)/$$modname.cpp"; then echo "$(MODDIR)/$$modname.cpp"; else echo "$(MODDIR)/$$modname.c"; fi`
 RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi `
 RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) `
 RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) `
@@ -68,7 +68,7 @@
 		ourcflags="$(RECURSE_OUR_CFLAGS)" ; \
 		ourldflags="$(RECURSE_OUR_LDFLAGS)" ; \
 		insertobjs="`$(LOCAL_INSERT_OBJS)`" ; \
-		$(MAKE) $(MAKE_OPTS) MODNAME="$$modname" SOURCEFILE="$$sourcefile" \
+		$(MAKE) $(MAKE_OPTS) MODNAME="$$modname" SOURCEFILE="$$sourcefile" MODDIR="$(MODDIR)" \
 			OUR_DEPS="$$ourdefs" OUR_CFLAGS="$$ourcflags" OUR_LDFLAGS="$$ourldflags" OUR_OBJS="$$insertobjs"
 
 all: Makefile
@@ -96,7 +96,7 @@
 
 Makefile:
 	@if test ! -f $@; then \
-	  if ! pwd | grep $(switch_srcdir)/src/mod ; then rulesdir=$(switch_srcdir) ; else rulesdir=../../../.. ; fi ; \
+	  if ! pwd | grep $(switch_builddir)/src/mod ; then rulesdir=$(switch_builddir) ; else rulesdir=../../../.. ; fi ; \
 	  echo BASE=$$rulesdir > Makefile ; \
 	  echo 'include $$(BASE)/build/modmake.rules' >> Makefile ; \
 	fi ;
@@ -164,7 +164,8 @@
 	@$(LTCXXCOMPILE) -c -o $@ $< || exit 1
 
 $(MODNAME).o $(MODNAME).lo: $(SOURCEFILE) \
-  $(switch_srcdir)/src/include/switch.h $(switch_srcdir)/src/include/switch_am_config.h \
+  $(switch_srcdir)/src/include/switch.h \
+  $(switch_builddir)/src/include/switch_am_config.h \
   $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
   $(switch_srcdir)/src/include/switch_core_db.h $(switch_srcdir)/src/include/switch_regex.h \
   $(switch_srcdir)/src/include/switch_core.h $(switch_srcdir)/src/include/switch_loadable_module.h \
@@ -179,7 +180,7 @@
 
 $(switch_srcdir)/src/include/switch.h:
 
-$(switch_srcdir)/src/include/switch_am_config.h:
+$(switch_builddir)/src/include/switch_am_config.h: $(switch_srcdir)/src/include/switch_am_config.h.in
 
 $(switch_srcdir)/src/include/switch_types.h:
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/en/vm/sounds.xml (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/en/vm/sounds.xml	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/en/vm/sounds.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -28,7 +28,7 @@
   <macro name="voicemail_hello">
     <input pattern="(.*)">
       <match>
-	<action function="play-file" data="voicemail/vm-hello.wav"/>
+	<!--<action function="play-file" data="voicemail/vm-hello.wav"/> -->
       </match>
     </input>
   </macro>
@@ -56,7 +56,6 @@
 	<action function="say" data="$1" method="pronounced" type="items"/>
 	<action function="play-file" data="voicemail/vm-$2.wav"/> 
 	<action function="play-file" data="voicemail/vm-message.wav"/>
-	<action function="play-file" data="voicemail/vm-in_folder.wav"/>
       </match>
     </input>
     <input pattern="^(\d+):(.*)$">
@@ -65,7 +64,6 @@
 	<action function="say" data="$1" method="pronounced" type="items"/>
 	<action function="play-file" data="voicemail/vm-$2.wav"/> 
 	<action function="play-file" data="voicemail/vm-messages.wav"/>
-	<action function="play-file" data="voicemail/vm-in_folder.wav"/>
       </match>
     </input>
   </macro>
@@ -89,7 +87,6 @@
     </input>
   </macro>
 
-
   <macro name="voicemail_config_menu">
     <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
       <match>
@@ -112,7 +109,6 @@
     </input>
   </macro>
 
-
   <macro name="voicemail_record_name">
     <input pattern="^(.*)$">
       <match>
@@ -182,7 +178,7 @@
   </macro>
 
   <macro name="voicemail_listen_file_check">
-    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):(.*)$">
       <match>
 	<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
 	<action function="play-file" data="voicemail/vm-press.wav"/>
@@ -204,6 +200,25 @@
 	<action function="say" data="$6" method="pronounced" type="name_spelled"/>
       </match>
     </input>
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-save_recording.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-delete_recording.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$3" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-return_call.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$5" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-to_forward.wav"/>
+	<action function="play-file" data="voicemail/vm-press.wav"/>
+	<action function="say" data="$6" method="pronounced" type="name_spelled"/>
+      </match>
+    </input>
   </macro>
 
   <macro name="voicemail_choose_greeting">
@@ -363,7 +378,4 @@
       </match>
     </input>
   </macro>
-
-
-
 </include><!--This line will be ignored it's here to validate the xml and is optional -->

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir (from rev 15704, freeswitch/trunk/conf/lang/ru/dir)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir/sounds.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir/sounds.xml (from rev 15704, freeswitch/trunk/conf/lang/ru/dir/sounds.xml) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir/sounds.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir/sounds.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,121 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+	<macro name="directory_intro">
+		<input pattern="^(last_name)" break_on_match="false">
+			<match>
+				<action function="play-file" data="directory/dir-enter-person.wav"/>
+				<action function="play-file" data="directory/dir-last_name.wav"/>
+			</match>
+		</input>
+		<input pattern="^(first_name)" break_on_match="false">
+			<match>
+                <action function="play-file" data="directory/dir-enter-person.wav"/>
+                <action function="play-file" data="directory/dir-first_name.wav"/>
+			</match>
+		</input>
+		<input pattern="^(last_name):([0-9#*])$" break_on_match="false">
+			<match>
+				<action function="play-file" data="directory/dir-to_search_by.wav"/>
+				<action function="play-file" data="directory/dir-first_name.wav"/>
+				<action function="play-file" data="directory/dir-press.wav"/>
+				<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+			</match>
+		</input>
+		<input pattern="^(first_name):([0-9#*])$" break_on_match="false">
+			<match>
+				<action function="play-file" data="directory/dir-to_search_by.wav"/>
+				<action function="play-file" data="directory/dir-last_name.wav"/>
+				<action function="play-file" data="directory/dir-press.wav"/>
+				<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_min_search_digits">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="play-file" data="directory/dir-specify_mininum_first.wav"/>
+				<action function="say" data="$1" method="pronounced" type="items"/>
+				<action function="play-file" data="directory/dir-letters_of_person_name.wav"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_count">
+		<input pattern="^0$" break_on_match="true">
+			<match>
+				<action function="play-file" data="directory/dir-no_match_entry.wav"/>
+			</match>
+		</input>
+		<input pattern="^(.*)$">
+			<match>
+				<action function="say" data="$1" method="pronounced" type="items"/>
+				<action function="play-file" data="directory/dir-result_match.wav"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_count_too_large">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="play-file" data="directory/dir-to_many_result.wav"/>
+			</match>
+		</input>
+
+	</macro>
+
+	<macro name="directory_result_last">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="play-file" data="directory/dir-no_more_result.wav"/>
+			</match>
+		</input>
+
+	</macro>
+
+	<macro name="directory_result_item">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="play-file" data="directory/dir-result_number.wav"/>
+				<action function="say" data="$1" method="pronounced" type="items"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_at">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="play-file" data="directory/dir-at_extension.wav"/>
+				<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_menu">
+		<input pattern="^([0-9#*]),([0-9#*]),([0-9#*]),([0-9#*])$">
+			<match>
+				<action function="play-file" data="directory/dir-to_select_entry.wav"/>
+				<action function="play-file" data="directory/dir-press.wav"/>
+				<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+				<action function="play-file" data="directory/dir-for_next.wav"/>
+				<action function="play-file" data="directory/dir-press.wav"/>
+				<action function="say" data="$2" method="pronounced" type="name_spelled"/>
+				<action function="play-file" data="directory/dir-for_prev.wav"/>
+				<action function="play-file" data="directory/dir-press.wav"/>
+				<action function="say" data="$3" method="pronounced" type="name_spelled"/>
+				<action function="play-file" data="directory/dir-to_make_new_search.wav"/>
+				<action function="play-file" data="directory/dir-press.wav"/>
+				<action function="say" data="$4" method="pronounced" type="name_spelled"/>
+
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_say_name">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+			</match>
+		</input>
+	</macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir/tts.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir/tts.xml (from rev 15704, freeswitch/trunk/conf/lang/ru/dir/tts.xml) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir/tts.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/dir/tts.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,96 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+
+	<macro name="directory_intro">
+		<input pattern="^(last_name)" break_on_match="false">
+			<match>
+				<action function="speak-text" data="Please enter the first few digit of the person last name"/>
+			</match>
+		</input>
+		<input pattern="^(first_name)" break_on_match="false">
+			<match>
+				<action function="speak-text" data="Please enter the first few digit of the person first name"/>
+			</match>
+		</input>
+		<input pattern="^(last_name):([0-9#*])$" break_on_match="false">
+			<match>
+				<action function="speak-text" data="to search by first name, press $2"/>
+			</match>
+		</input>
+		<input pattern="^(first_name):([0-9#*])$" break_on_match="false">
+			<match>
+				<action function="speak-text" data="to search by last name, press $2"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_min_search_digits">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="speak-text" data="You need to specify a minimum the first $1 letters of the person name, try again."/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_count">
+		<input pattern="^0$" break_on_match="true">
+			<match>
+				<action function="speak-text" data="Your search match no user on this system, try again."/>
+			</match>
+		</input>
+		<input pattern="^(.*)$">
+			<match>
+				<action function="speak-text" data="$1 result match your search"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_count_too_large">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="speak-text" data="Your search returned too many result, please try again"/>
+			</match>
+		</input>
+
+	</macro>
+
+	<macro name="directory_result_last">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="speak-text" data="No more result"/>
+			</match>
+		</input>
+
+	</macro>
+
+	<macro name="directory_result_item">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="speak-text" data="Result number $1"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_menu">
+		<input pattern="^([0-9#*]),([0-9#*]),([0-9#*]),([0-9#*])$">
+			<match>
+				<action function="speak-text" data="To select this entry press $1, for the next entry press $2, for the previous entry press $3, to make a new search press $4"/>
+			</match>
+		</input>
+	</macro>
+
+	<macro name="directory_result_at">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="speak-text" data="at extension $1"/>
+			</match>
+		</input>
+	</macro>
+	<macro name="directory_result_say_name">
+		<input pattern="^(.*)$">
+			<match>
+				<action function="speak-text" data="$1"/>
+			</match>
+		</input>
+	</macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/vm/sounds.xml (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/vm/sounds.xml	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/lang/ru/vm/sounds.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -57,7 +57,7 @@
 	<action function="say" data="$1" method="pronounced" type="MESSAGES"/>
 	<action function="play-file" data="voicemail/vm-$2.wav"/> 
 	<action function="play-file" data="voicemail/vm-message.wav"/>
-	<action function="play-file" data="voicemail/vm-in_folder.wav"/>
+<!--	<action function="play-file" data="voicemail/vm-in_folder.wav"/>-->
       </match>
     </input>
     <!-- от 10 до 19 и ноль   --> <!-- от 5до 9 и больше 20-ти 25-29   -->
@@ -67,7 +67,7 @@
 	<action function="say" data="$1" method="pronounced" type="MESSAGES"/>
 	<action function="play-file" data="voicemail/vm-$2x.wav"/> 
 	<action function="play-file" data="voicemail/vm-messagex.wav"/>
-	<action function="play-file" data="voicemail/vm-in_folder.wav"/>
+<!--	<action function="play-file" data="voicemail/vm-in_folder.wav"/>-->
       </match>
     </input>
     <input pattern="^(\d+[0,2-9][2-4]|[2-9][2-4]|[2-4]):(.*)$"> 
@@ -193,26 +193,45 @@
   </macro>
 
   <macro name="voicemail_listen_file_check">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):(.*)$">
+      <match>
+        <action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-save_recording.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-delete_recording.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$3" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-forward_to_email.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$4" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-return_call.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$5" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-to_forward.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$6" method="pronounced" type="name_spelled"/>
+      </match>
+    </input>
     <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
       <match>
-	<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
-	<action function="play-file" data="voicemail/vm-press.wav"/>
-	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
-	<action function="play-file" data="voicemail/vm-save_recording.wav"/>
-	<action function="play-file" data="voicemail/vm-press.wav"/>
-	<action function="say" data="$2" method="pronounced" type="name_spelled"/>
-	<action function="play-file" data="voicemail/vm-delete_recording.wav"/>
-	<action function="play-file" data="voicemail/vm-press.wav"/>
-	<action function="say" data="$3" method="pronounced" type="name_spelled"/>
-	<action function="play-file" data="voicemail/vm-forward_to_email.wav"/>
-	<action function="play-file" data="voicemail/vm-press.wav"/>
-	<action function="say" data="$4" method="pronounced" type="name_spelled"/>
-	<action function="play-file" data="voicemail/vm-return_call.wav"/>
-	<action function="play-file" data="voicemail/vm-press.wav"/>
-	<action function="say" data="$5" method="pronounced" type="name_spelled"/>
-	<action function="play-file" data="voicemail/vm-to_forward.wav"/>
-	<action function="play-file" data="voicemail/vm-press.wav"/>
-	<action function="say" data="$6" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-save_recording.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$2" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-delete_recording.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$3" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-return_call.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$5" method="pronounced" type="name_spelled"/>
+        <action function="play-file" data="voicemail/vm-to_forward.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="say" data="$6" method="pronounced" type="name_spelled"/>
       </match>
     </input>
   </macro>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/external.xml (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/external.xml	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/external.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -24,7 +24,8 @@
     <param name="dialplan" value="XML"/>
     <param name="context" value="public"/>
     <param name="dtmf-duration" value="100"/>
-    <param name="codec-prefs" value="$${outbound_codec_prefs}"/>
+    <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+    <param name="outbound-codec-prefs" value="$${outbound_codec_prefs}"/>
     <param name="hold-music" value="$${hold_music}"/>
     <param name="rtp-timer-name" value="soft"/>
     <!--<param name="enable-100rel" value="true"/>-->

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/internal-ipv6.xml (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/internal-ipv6.xml	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/internal-ipv6.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -14,7 +14,8 @@
     <param name="sip-port" value="$${internal_sip_port}"/>
     <param name="dialplan" value="XML"/>
     <param name="dtmf-duration" value="100"/>
-    <param name="codec-prefs" value="$${global_codec_prefs}"/>
+    <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+    <param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
     <param name="use-rtp-timer" value="true"/>
     <param name="rtp-timer-name" value="soft"/>
     <!-- ip address to use for rtp -->

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/internal.xml (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/internal.xml	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/sip_profiles/internal.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -40,13 +40,15 @@
     <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
     <param name="debug" value="0"/>
     <param name="sip-trace" value="no"/>
+    <param name="log-auth-failures" value="true"/>
     <param name="context" value="public"/>
     <param name="rfc2833-pt" value="101"/>
     <!-- port to bind to for sip traffic -->
     <param name="sip-port" value="$${internal_sip_port}"/>
     <param name="dialplan" value="XML"/>
     <param name="dtmf-duration" value="100"/>
-    <param name="codec-prefs" value="$${global_codec_prefs}"/>
+    <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
+    <param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
     <param name="rtp-timer-name" value="soft"/>
     <!-- ip address to use for rtp, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
     <param name="rtp-ip" value="$${local_ip_v4}"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/vars.xml (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/vars.xml	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/conf/vars.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -51,6 +51,8 @@
        speex@8000h@20i  - Speex 8kHz using 20ms ptime.
        speex@16000h@20i - Speex 16kHz using 20ms ptime.
        speex@32000h@20i - Speex 32kHz using 20ms ptime.
+       BV16             - BroadVoice 16kb/s narrowband, 8kHz
+       BV32             - BroadVoice 32kb/s wideband, 16kHz
        G7221@16000h     - G722.1 16kHz (aka Siren 7)
        G7221@32000h     - G722.1C 32kHz (aka Siren 14)
        CELT@32000h      - CELT 32kHz, only 10ms supported

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/configure.in (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/configure.in	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/configure.in	2009-11-29 05:19:09 UTC (rev 15705)
@@ -95,8 +95,8 @@
 fi
 
 # set defaults for use on all platforms
-SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_srcdir}/libs/libteletone/src"
-SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_srcdir}/libs/libteletone/src"
+SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
+SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src"
 SWITCH_AM_LDFLAGS="-lm"
 
 #set SOLINK variable based on compiler and host

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/dvarnes (from rev 15704, freeswitch/trunk/contrib/dvarnes)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/dvarnes/java (from rev 15704, freeswitch/trunk/contrib/dvarnes/java)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/dvarnes/java/esl-client (from rev 15704, freeswitch/trunk/contrib/dvarnes/java/esl-client)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf (from rev 15704, freeswitch/trunk/contrib/sathieu/email2pdf)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/README

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/README (from rev 15704, freeswitch/trunk/contrib/sathieu/email2pdf/README) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/README	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/README	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,29 @@
+email2pdf - Render email as pdf
+
+Copyright (c) 2009 Mathieu Parent <math.parent@gmail.com>
+This  program is free  software; you can redistribute  it and/or
+modify it  under the terms of the GNU  General Public License as
+published by the  Free Software Foundation; either version 2, or
+(at your option) any later version.
+
+QUICK START GUIDE:
+
+    email2pdf uses the following modules:
+
+	Getopt::Long                - required
+	Pod::Usage                  - required
+	File::Temp                  - required
+	Email::MIME                 - required
+	Email::MIME::ContentType    - required
+	Template                    - required
+
+    email2pdf uses the following tools to convert parts:
+
+	html2ps                          - for html and plain
+	openoffice.org thru ooextract.py - for OpenDocument (Text, Spreadsheet, Presentation, Graphics)
+	                                   for MS Word, Excel, PowerPoint
+	                                   See <http://blogs.igalia.com/berto/2007/09/15/converting-office-documents-into-pdf-from-the-command-line/>
+	imagemagick's convert            - for gif, jpeg, png and tiff
+
+Share and Enjoy!
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/email2pdf

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/email2pdf (from rev 15704, freeswitch/trunk/contrib/sathieu/email2pdf/email2pdf) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/email2pdf	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/email2pdf	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,274 @@
+#!/usr/bin/perl
+=head1 NAME
+
+email2pdf - Render email as pdf
+
+=head1 SYNOPSIS
+
+B<email2pdf> [options] filein fileout
+
+=head1 ARGUMENTS
+
+=over 8
+
+=item I<filein>
+
+RFC2822 email. Use - for stdin.
+
+=item I<fileout>
+
+PDF file. Use - for stdout.
+
+=back
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<--help>
+
+Print a brief help message and exits.
+
+=item B<--man>
+
+Prints the manual page and exits.
+
+=item B<--header>=header.html
+
+Set header file. This file will be processed using Template-Toolkit.
+
+=back
+
+=head1 COPYRIGHT AND AUTHORS
+
+Copyright (c) 2009 Mathieu Parent <math.parent@gmail.com>
+
+=head1 LICENSE
+
+This  program is free  software; you can redistribute  it and/or
+modify it  under the terms of the GNU  General Public License as
+published by the  Free Software Foundation; either version 2, or
+(at your option) any later version.
+
+This program is  distributed in the hope that it will be useful,
+but WITHOUT  ANY WARRANTY; without even the  implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You can view the  GNU General Public License, online, at the GNU
+Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+
+=cut
+
+
+use strict;
+use warnings;
+
+use Getopt::Long;
+use Pod::Usage;
+
+use File::Temp qw/tempdir tempfile/;
+use Email::MIME;
+use Email::MIME::ContentType;
+use Template;
+
+# =========================================================================== #
+# CONFIG
+
+my $mime_types = {
+	#plain and html
+	'text/plain' => 'plain',
+	'text/html' => 'html',
+	
+	#images
+	'image/gif' => 'gif',
+	'image/jpeg' => 'jpeg',
+	'image/png' => 'png',
+	'image/tiff' => 'tiff',
+
+	#OpenDocument
+	'application/vnd.oasis.opendocument.text' => 'opendoctext',
+	'application/vnd.oasis.opendocument.spreadsheet' => 'opendocspreadsheet',
+	'application/vnd.oasis.opendocument.presentation' => 'opendocpresentation',
+	'application/vnd.oasis.opendocument.graphics' => 'opendocgraphics',
+	                                                        
+	#MS office
+	'application/vnd.ms-excel' => 'msexcel',
+	'application/msexcel' => 'msexcel',
+	'application/x-msexcel' => 'msexcel',
+	'application/vnd.ms-powerpoint' => 'mspowerpoint',
+	'application/vnd.ms-word' => 'msword',
+	'application/msword' => 'msword',
+	
+	'application/pdf' => 'pdf',
+	
+};
+my $mime_drivers = {
+	#plain and html
+	'plain' => ['.txt', 'html2ps FILE | ps2pdf - -'],
+	'html' => ['.html', 'html2ps FILE | ps2pdf - -'],
+	
+	#images
+	'gif' => ['.gif', 'convert FILE pdf:-'],
+	'jpeg' => ['.jpeg', 'convert FILE pdf:-'],
+	'png' => ['.png', 'convert FILE pdf:-'],
+	'tiff' => ['.tiff', 'convert FILE pdf:-'],
+	
+	#OpenDocument
+	'opendoctext' => ['.odt', 'python /root/ooextract.py --pdf --stdout FILE'],
+	'opendocspreadsheet' => ['.ods', 'python /root/ooextract.py --pdf --stdout FILE'],
+	'opendocpresentation' => ['.odp', 'python /root/ooextract.py --pdf --stdout FILE'],
+	'opendocgraphics' => ['.odg', 'python /root/ooextract.py --pdf --stdout FILE'],
+
+	#MS office
+	'msexcel' => ['.xls', 'python /root/ooextract.py --pdf --stdout FILE'],
+	'mspowerpoint' => ['.ppt', 'python /root/ooextract.py --pdf --stdout FILE'],
+	'msword' => ['.doc', 'python /root/ooextract.py --pdf --stdout FILE'],
+	'pdf' => ['.pdf', 'cat FILE'],
+};
+# Template config
+my $tt_config = {
+};
+
+# =========================================================================== #
+# vars
+my @files;
+push @files, (0);
+
+my $email;
+my $output_dir;
+
+# options
+my $o_help = 0;
+my $o_man = 0;
+my $o_header = 'header.html';
+# =========================================================================== #
+sub process_raw
+{
+	my $filename = shift || 'noname';
+	my $content_type = shift;
+	my $raw = shift;
+	my $is_header = shift || 0;
+	if(defined($mime_types->{$content_type})) {
+		if(defined($mime_drivers->{$mime_types->{$content_type}})) {
+			my @mime_driver = $mime_drivers->{$mime_types->{$content_type}};
+			my $suffix = $mime_driver[0][0];
+			my $command = $mime_driver[0][1];
+			my ($fh_in, $filename_in) = tempfile( DIR => $output_dir, SUFFIX => $suffix );
+			system("chmod +r $filename_in");
+			print { $fh_in } $raw;
+			close $fh_in or warn $! ? "Error closing sort pipe: $!" : "Exit status $? from sort";
+			$command =~ s/FILE/$filename_in/;
+			print STDERR "Processing '$filename' ($content_type). From '$filename_in'. ";
+			my $out = `$command`;
+			if(!$out) {
+				print STDERR "Empty generated PDF.\n";
+				return;
+			}
+			my ($fh_out, $filename_out) = tempfile( DIR => $output_dir, SUFFIX => '.pdf' );
+			print STDERR "To '$filename_out'. ";
+			print { $fh_out } $out;
+			close $fh_out or warn $! ? "Error closing sort pipe: $!" : "Exit status $? from sort";
+			if($is_header) {
+				shift @files;
+				unshift @files, ($filename_out);
+			} else {
+				push @files, ($filename_out);
+			}
+			print STDERR "\n";
+		} else {
+			print STDERR "Undefined mime driver: $mime_types->{$content_type}\n";
+		}
+	} else {
+		print STDERR "Undefined mime type: $content_type\n";
+	}
+}
+
+sub process_header
+{
+	my $parsed = shift;
+	unshift @files, (0) if $files[0] != 0;
+	# define template variables for replacement
+	my $vars = {
+		body => '', #$parsed->body,
+		body_raw => $parsed->body_raw,
+		content_type => $parsed->content_type,
+		mail => $parsed,
+	};
+
+	# specify input filename, or file handle, text reference, etc.
+	my $content_type = `file --mime-type --brief header.html`;
+	$content_type =~ s/\s+$//; # trim end whitespace
+	my $header = '';
+
+	# create Template object
+	my $template = Template->new($tt_config);
+
+	# process input template, substituting variables
+	$template->process($o_header, $vars, \$header)
+		|| die $template->error();
+	process_raw $parsed->filename, $content_type, $header, 1;
+}
+
+sub process_part
+{
+	my $part = shift;
+	my $parsed_content_type = parse_content_type($part->content_type);
+	my $content_type = $parsed_content_type->{'discrete'}.'/'.$parsed_content_type->{'composite'};
+	if($content_type eq 'multipart/alternative') {
+		my @subparts = $part->subparts;
+		foreach my $subpart (@subparts) {
+			return if $subpart->parts > 1; # multipart
+			my $parsed_subcontent_type = parse_content_type($subpart->content_type);
+			my $subcontent_type = $parsed_subcontent_type->{'discrete'}.'/'.$parsed_subcontent_type->{'composite'};
+			process_raw $subpart->filename, $subcontent_type, $subpart->body, 1;
+		}
+	} else {
+		process_raw $part->filename, $content_type, $part->body;
+	}
+}
+
+# =========================================================================== #
+my $result = GetOptions(
+    'help|?' => \$o_help,
+    'man' => \$o_man,
+    'header=s' => \$o_header,
+    );
+
+pod2usage(-exitstatus => 0, -verbose => 2) if $o_man;
+pod2usage(-exitstatus => 0, -verbose => 1) if $o_help;
+
+my $file_in = shift @ARGV;
+if(!defined($file_in)) {
+	print "Missing argument: filein\n";
+	pod2usage(-exitstatus => 0, -verbose => 1);
+	exit 1;
+}
+my $file_out = shift @ARGV;
+if(!defined($file_out)) {
+	print "Missing argument: fileout\n";
+	pod2usage(-exitstatus => 0, -verbose => 1);
+	exit 1;
+}
+
+# =========================================================================== #
+# setup temp dir
+$output_dir = tempdir( CLEANUP => 1 );
+system("chmod +rwx $output_dir");
+
+# load mail
+if($file_in eq "-") {
+	$email = Email::MIME->new(join('',<>));
+} else {
+	open(FILEIN, '<', $file_in);
+	$email = Email::MIME->new(join('',<FILEIN>));
+	close(FILEIN);
+}
+
+my @parts = $email->subparts;
+foreach my $part (@parts) {
+	process_part $part;
+}
+process_header($email);
+print "Merging files: ".join(' ', @files)."\n";
+system('pdftk '.join(' ', @files)." cat output $file_out");

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/header.html

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/header.html (from rev 15704, freeswitch/trunk/contrib/sathieu/email2pdf/header.html) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/header.html	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/contrib/sathieu/email2pdf/header.html	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+  <title>[% mail.header('Subject') %]</title>
+ </head>
+ <body>
+ <h3>Fax</h3>
+From : [% mail.header('From') %]<br>
+Subject : [% mail.header('Subject') %]<br>
+[% body %]
+</body>
+</html>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/docs/phrase/phrase_en.xml (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/docs/phrase/phrase_en.xml	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/docs/phrase/phrase_en.xml	2009-11-29 05:19:09 UTC (rev 15705)
@@ -316,11 +316,27 @@
       <prompt phrase="You are about to provision this phone permanently to your extension." filename="ivr-provision_phone_permanently_to_extension.wav"/>
       <prompt phrase="Please enter the extension number to which you would like to provision this phone, followed by the pound sign." filename="ivr-extension_to_provision_this_phone.wav"/>
       <prompt phrase="Thank you, this phone will now reboot." filename="ivr-this_phone_will_now_reboot.wav"/>
-      <!-- The following three phrases still need to be recorded -->
+      <!-- The following phrases still need to be recorded -->
       <prompt phrase="Thank you. Your recording has been saved." filename="ivr-recording_saved.wav" attr="Needs_to_be_recorded!"/>
       <prompt phrase="Press 1 to save your recording. Press 2 to review your recording. Press 3 to re-record." filename="ivr-save_review_record.wav" attr="Needs_to_be_recorded!"/>
-      <prompt phrase="The system is unable to save your sound file at this time. Please try again later." filename="ivr-unable_save" attr="Needs_to_be_recorded!"/>
-
+      <prompt phrase="The system is unable to save your sound file at this time. Please try again later." filename="ivr-unable_save.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="You are number" filename="ivr-you_are_number.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="In line." filename="ivr-in_line.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Thank you for holding." filename="ivr-thank_you_for_holding.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Your estimated hold time is..." filename="ivr-estimated_hold_time.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="More than..." filename="ivr-more_than.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Less than..." filename="ivr-less_than.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Begin recording." filename="ivr-begin_recording.wav " attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Call forwarding has been cancelled." filename="ivr-call_forwarding_has_been_cancelled.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Call forwarding has been set." filename="ivr-call_forwarding_has_been_set.wav " attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Please enter the phone number." filename="ivr-please_enter_the_phone_number.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Please state your name and the reason for your call." filename="ivr-please_state_your_name_and_reason_for_calling.wav " attr="Needs_to_be_recorded!"/>
+      <prompt phrase="To accept, press 1. To reject, press 2. To send to voicemail, press 3." filename="ivr-accept_reject_voicemail.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Incoming call." filename="ivr-incoming_call.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Thank you for calling." filename="ivr-thank_you_for_calling.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Please stay on the line. You call will be answered momentarily." filename="ivr-stay_on_line_call_answered_momentarily.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Your call is being transferred." filename="ivr-call_being_transferred.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Please enjoy the music while your call is being transferred." filename="ivr-enjoy_music_while_transfer.wav" attr="Needs_to_be_recorded!"/>
     </ivr>
     <misc>
       <prompt phrase="This call has been secured" filename="call_secured.wav"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/freeswitch.spec (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/freeswitch.spec	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/freeswitch.spec	2009-11-29 05:19:09 UTC (rev 15705)
@@ -315,18 +315,18 @@
 PASSTHRU_CODEC_MODULES="codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb"
 SPIDERMONKEY_MODULES="languages/mod_spidermonkey languages/mod_spidermonkey_curl languages/mod_spidermonkey_core_db languages/mod_spidermonkey_odbc languages/mod_spidermonkey_socket languages/mod_spidermonkey_teletone"
 APPLICATIONS_MODULES="applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_limit applications/mod_rss applications/mod_voicemail applications/mod_directory applications/mod_fsv applications/mod_lcr applications/mod_easyroute applications/mod_stress applications/mod_vmd applications/mod_limit applications/mod_soundtouch applications/mod_fax"
-CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_voipcodecs codecs/mod_speex codecs/mod_celt codecs/mod_siren"
+CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_voipcodecs codecs/mod_speex codecs/mod_celt codecs/mod_siren codecs/mod_bv"
 DIALPLANS_MODULES="dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml"
 DIRECTORIES_MODULES=""
 ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_sofia ../../libs/openzap/mod_openzap endpoints/mod_loopback"
 ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_unimrcp"
 EVENT_HANDLERS_MODULES="event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv"
 FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout"
-LANGUAGES_MODULES="languages/mod_perl languages/mod_lua languages/mod_python languages/mod_yaml"
+LANGUAGES_MODULES="languages/mod_perl languages/mod_lua languages/mod_python"
 LOGGERS_MODULES="loggers/mod_console loggers/mod_logfile loggers/mod_syslog"
 SAY_MODULES="say/mod_say_en say/mod_say_de say/mod_say_fr"
 TIMERS_MODULES=
-DISABLED_MODULES="applications/mod_soundtouch languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf languages/mod_managed languages/mod_java say/mod_say_it say/mod_say_es say/mod_say_nl"
+DISABLED_MODULES="applications/mod_soundtouch languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf languages/mod_managed languages/mod_java say/mod_say_it say/mod_say_es say/mod_say_nl languages/mod_yaml"
 XML_INT_MODULES="xml_int/mod_xml_rpc  xml_int/mod_xml_curl xml_int/mod_xml_cdr "
 MYMODULES="$PASSTHRU_CODEC_MODULES $SPIDERMONKEY_MODULES $APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES"
 
@@ -580,8 +580,8 @@
 %{prefix}/mod/mod_lcr.so
 %{prefix}/mod/mod_loopback.so
 %{prefix}/mod/mod_siren.so
+%{prefix}/mod/mod_bv.so
 %{prefix}/mod/mod_stress.so
-%{prefix}/mod/mod_yaml.so
 %{prefix}/mod/mod_shout.so
 %{prefix}/mod/mod_fax.so
 %{prefix}/mod/mod_soundtouch.so
@@ -694,6 +694,7 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/demo/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/vm/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/dir/*.xml
 
 %files moh
 %dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/8000
@@ -811,6 +812,11 @@
 
 
 %changelog
+* Wed Nov 25 2009 - brian@freeswitch.org
+- added mod_bv.so
+* Wed Nov 25 2009 - michal.bielicki@seventhsignal.de
+- Removed mod_yaml
+- added directory files to russian language
 * Sat Nov 21 2009 - michal.bielicki@seventhsignal.de
 - added patch by Igor Neves <neves.igor@gmail.com>: Added some checkup in %post and %postun to prevent upgrades from removing freeswitch user
 * Thu Nov 18 2009 - michal.bielicki@seventhsignal.de

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/apr/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/apr/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/apr/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/apr-util/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/apr-util/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/apr-util/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --with-apr=../apr --disable-shared --with-pic --without-sqlite2 --without-sqlite3 --with-expat=builtin
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --with-apr=../apr --disable-shared --with-pic --without-sqlite2 --without-sqlite3 --with-expat=builtin
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/broadvoice/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/broadvoice/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/broadvoice/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/curl/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/curl/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/curl/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --without-libidn --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --without-libidn --disable-shared --with-pic
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/esl/perl/logger.pl (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/esl/perl/logger.pl	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/esl/perl/logger.pl	2009-11-29 05:19:09 UTC (rev 15705)
@@ -23,7 +23,7 @@
 -f --file <file>            Output file
 -pb --paste-bin <name>	    Post to FreeSWITCH Paste Bin
 -sp --sip-profiles <list>   List of SIP profiles to trace
--sd --sip-debug <leve>      Set SIP debug level
+-sd --sip-debug <level>      Set SIP debug level
 
 No arguments given will trace profile 'internal' to STDOUT
 ";

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/esl/src/esl.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/esl/src/esl.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/esl/src/esl.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -833,7 +833,7 @@
 				}
 				
 				if (!revent) {
-					esl_event_create(&revent, ESL_EVENT_COMMAND);
+					esl_event_create(&revent, ESL_EVENT_CLONE);
 				}
 				
 				hname = beg;
@@ -910,7 +910,7 @@
 		}
 
 		if (!esl_safe_strcasecmp(hval, "text/event-plain") && revent->body) {
-			esl_event_types_t et = ESL_EVENT_COMMAND;
+			esl_event_types_t et = ESL_EVENT_CLONE;
 			char *body = strdup(revent->body);
 			
 			esl_event_create(&handle->last_ievent, et);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/iksemel/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/iksemel/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/iksemel/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@"  --disable-shared --with-pic 
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/ilbc/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/ilbc/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/ilbc/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --with-pic --disable-shared
+srcpath=$(dirname $0)
+$srcpath/configure "$@" --with-pic --disable-shared
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/Makefile.in (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/Makefile.in	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/Makefile.in	2009-11-29 05:19:09 UTC (rev 15705)
@@ -156,7 +156,7 @@
 	@$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
 
 $(LIB_NAME): $(LIB_OBJS)
-	@$(LIBTOOL) --mode=link $(CC) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) -version-info 1:6
+	@$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) -version-info 1:6
 
 $(CLI_NAME): $(CLI_OBJS) $(LIB_NAME)
 	@$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(CLI_LDFLAGS) $(CFLAGS) -o $(CLI_NAME) $(CLI_OBJS) $(LIB_NAME) $(LIBS) $(CLI_LIBS)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --with-pic --with-nspr=yes
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --with-pic --with-nspr=yes
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/nsprpub/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/nsprpub/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/nsprpub/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --with-pic
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/nsprpub/configure.in (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/nsprpub/configure.in	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/js/nsprpub/configure.in	2009-11-29 05:19:09 UTC (rev 15705)
@@ -617,7 +617,7 @@
 LIB_SUFFIX=a
 DLL_SUFFIX=so
 ASM_SUFFIX=s
-MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
+MKSHLIB='$(LD) $(DSO_LDOPTS) $(OS_LDFLAGS) -o $@'
 PR_MD_ASFILES=
 PR_MD_CSRCS=
 PR_MD_ARCH_DIR=unix
@@ -986,7 +986,7 @@
     DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name ${prefix}/lib/$@ -headerpad_max_install_names'
     # Use the standard preprocessor (cpp)
     CFLAGS="$CFLAGS -no-cpp-precomp"
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(OS_LDFLAGS) -o $@'
     STRIP="$STRIP -x -S"
     DLL_SUFFIX=dylib
     USE_PTHREADS=1
@@ -1132,7 +1132,7 @@
     else
         DLL_SUFFIX=so.1
     fi
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(OS_LDFLAGS) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
     MDCPUCFG_H=_freebsd.cfg
@@ -1401,7 +1401,7 @@
     esac
     MDCPUCFG_H=_linux.cfg
     PR_MD_CSRCS=linux.c
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(OS_LDFLAGS) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
     _OPTIMIZE_FLAGS=-O2
@@ -1660,7 +1660,7 @@
     DSO_CFLAGS='-fPIC -DPIC'
     CFLAGS="$CFLAGS -ansi -Wall"
     CXXFLAGS="$CXXFLAGS -ansi -Wall"
-    MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
+    MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS) $(OS_LDFLAGS) '
 
     if test -z "$OBJECT_FMT"; then
         if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ 2>/dev/null; then
@@ -1741,7 +1741,7 @@
         USE_PTHREADS=1
     fi
     DSO_LDOPTS='-shared -fPIC'
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(OS_LDFLAGS) -o $@'
     ;;
 
 *-openvms*)
@@ -1911,7 +1911,7 @@
     MDCPUCFG_H=_solaris.cfg
     PR_MD_CSRCS=solaris.c
     LD=/usr/ccs/bin/ld
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) $(OS_LDFLAGS) -o $@'
     RESOLVE_LINK_SYMBOLS=1
     if test -n "$GNU_CC"; then
         DSO_CFLAGS=-fPIC

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libdingaling/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libdingaling/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libdingaling/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libedit/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libedit/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libedit/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
+

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libg722_1/configure.gnu (from rev 15704, freeswitch/trunk/libs/libg722_1/configure.gnu) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libg722_1/configure.gnu	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libg722_1/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,4 @@
+#! /bin/sh
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libsndfile/M4/ltoptions.m4

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libsndfile/M4/ltsugar.m4

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libsndfile/M4/ltversion.m4

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libsndfile/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libsndfile/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libsndfile/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
-#! /bin/sh
-./configure "$@" --disable-sqlite --disable-shared --with-pic --disable-external-libs --disable-octave
+#!/bin/sh
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-sqlite --disable-shared --with-pic --disable-octave --disable-external-libs
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libteletone/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libteletone/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/libteletone/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/pcre/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/pcre/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/pcre/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/portaudio/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/portaudio/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/portaudio/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --with-pic --disable-shared
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --with-pic --disable-shared
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/sofia-sip/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/sofia-sip/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/sofia-sip/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --with-pic --with-glib=no --disable-shared --without-doxygen
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --with-pic --with-glib=no --disable-shared  --without-doxygen
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/spandsp/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/spandsp/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/spandsp/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic --enable-builtin-tiff
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic --enable-builtin-tiff
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/spandsp/src/gsm0610_rpe.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/spandsp/src/gsm0610_rpe.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/spandsp/src/gsm0610_rpe.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -55,11 +55,20 @@
 
 /* 4.2.13 .. 4.2.17  RPE ENCODING SECTION */
 
+#if defined(__GNUC__)  &&  defined(__i386__)
+#define SPANDSP_USE_I386_ASM
+#if (defined(__APPLE__) || defined(macintosh)) && defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+#undef SPANDSP_USE_I386_ASM
+#endif
+#endif
+#endif
+
 /* 4.2.13 */
 static void weighting_filter(const int16_t *e,     // signal [-5..0.39.44] IN
                              int16_t x[40])
 {
-#if defined(__GNUC__)  &&  defined(__i386__)
+#if defined(SPANDSP_USE_I386_ASM)
     /* Table 4.4   Coefficients of the weighting filter */
     /* This must be padded to a multiple of 4 for MMX to work */
     static const union

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/speex/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/speex/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/speex/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic --disable-oggtest
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic --disable-oggtest
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/sqlite/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/sqlite/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/sqlite/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-tcl --enable-threadsafe --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-tcl --enable-threadsafe --disable-shared --with-pic
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/srtp/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/srtp/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/srtp/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
 

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/tiff-3.8.2/config/install-sh

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/tiff-3.8.2/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/tiff-3.8.2/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/tiff-3.8.2/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-shared --with-pic
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-shared --with-pic
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/unimrcp/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/unimrcp/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/unimrcp/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,3 +1,4 @@
 #! /bin/sh
-./configure "$@" --with-apr=../apr --disable-shared --with-pic --with-apr-util=../apr-util --with-sofia-sip=../sofia-sip
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --with-apr=../apr --disable-shared --with-pic --with-apr-util=../apr-util --with-sofia-sip=../sofia-sip
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/xmlrpc-c/configure.gnu (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/xmlrpc-c/configure.gnu	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/libs/xmlrpc-c/configure.gnu	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1,2 +1,4 @@
 #! /bin/sh
-./configure "$@" --disable-cplusplus --disable-wininet-client --disable-libwww-client --disable-shared --with-pic --disable-curl-client
+srcpath=$(dirname $0 2>/dev/null )  || srcpath="." 
+$srcpath/configure "$@" --disable-cplusplus --disable-wininet-client --disable-libwww-client --disable-shared --with-pic --disable-curl-client
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_caller.h (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_caller.h	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_caller.h	2009-11-29 05:19:09 UTC (rev 15705)
@@ -161,7 +161,18 @@
 															 _In_ switch_caller_extension_t *caller_extension,
 															 _In_z_ const char *application_name, _In_z_ const char *extra_data);
 
+/*!
+  \brief Add an application (instruction) to the given extension
+  \param session session associated with the extension (bound by scope)
+  \param caller_extension extension to add the application to
+  \param application_name the name of the application
+  \param fmt optional argument to the application (printf format string)
+*/
+SWITCH_DECLARE(void) switch_caller_extension_add_application_printf(_In_ switch_core_session_t *session,
+															 _In_ switch_caller_extension_t *caller_extension,
+															 _In_z_ const char *application_name, _In_z_ const char *fmt, ...);
 
+
 /*!
   \brief Get the value of a field in a caller profile based on it's name
   \param caller_profile The caller profile

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_core.h (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_core.h	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_core.h	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1959,6 +1959,9 @@
 	switch_mutex_t *mutex;
 	switch_memory_pool_t *pool;
 	int32_t flags;
+	unsigned long hash;
+	char creator[CACHE_DB_LEN];
+	char last_user[CACHE_DB_LEN];
 } switch_cache_db_handle_t;
 
 
@@ -1995,6 +1998,7 @@
 SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cache_db_handle_t *dbh, const char *sql, 
 																	 switch_core_db_callback_func_t callback, void *pdata, char **err);
 
+SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream);
 SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t **dbh, const char *file, const char *func, int line);
 #define switch_core_db_handle(_a) _switch_core_db_handle(_a, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_types.h (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_types.h	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_types.h	2009-11-29 05:19:09 UTC (rev 15705)
@@ -804,7 +804,7 @@
 typedef enum {
 	SCSMF_DYNAMIC = (1 << 0),
 	SCSMF_FREE_STRING_REPLY = (1 << 1),
-	SCSMF_FREE_POINTER_REPLY = (1 << 2),
+	SCSMF_FREE_POINTER_REPLY = (1 << 2)
 } switch_core_session_message_flag_enum_t;
 typedef uint32_t switch_core_session_message_flag_t;
 
@@ -942,6 +942,7 @@
 	CF_SIGNAL_BRIDGE_TTL,
 	CF_MEDIA_BRIDGE_TTL,
 	CF_BYPASS_MEDIA_AFTER_BRIDGE,
+	CF_LEG_HOLDING,
 	/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
 	CF_FLAG_MAX
 } switch_channel_flag_t;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_utils.h (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_utils.h	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/include/switch_utils.h	2009-11-29 05:19:09 UTC (rev 15705)
@@ -207,7 +207,7 @@
 enum switch_uri_flags {
 	SWITCH_URI_NUMERIC_HOST = 1,
 	SWITCH_URI_NUMERIC_PORT = 2,
-	SWITCH_URI_NO_SCOPE = 4,
+	SWITCH_URI_NO_SCOPE = 4
 };
 
 /*!

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/Makefile.am (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/Makefile.am	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/Makefile.am	2009-11-29 05:19:09 UTC (rev 15705)
@@ -8,10 +8,16 @@
 	target=`echo $@ | sed -e 's|^.*-||'`; \
 	modname=`echo $@ | sed -e 's|-.*||' | sed -e 's|^.*/||'`; \
 	confmoddir=`cat $(switch_builddir)/modules.conf | sed -e 's| ||' | grep $$modname$$ | sed -e 's|#||' | head -n 1`; \
-	if test -z "$$confmoddir" ; then moddir=$@ ; else  \
+	if test -z "$$confmoddir" ; then \
+		moddir=$@ ; \
+		buildmoddir=$(switch_builddir)/src/mod/$@ ;\
+	else  \
 		if test -d  "$(switch_srcdir)/src/mod/$$confmoddir" ; then \
-			moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; else \
+			moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; \
+			buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \
+		else \
 			moddir="$$confmoddir" ; \
+			buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \
 		fi ; \
 	fi ; \
 	if test -z "$$target" ; then target="all" ; fi ; \
@@ -20,8 +26,10 @@
 		echo ;\
 		echo making $$target $$modname ;\
 		(if test -f "$$moddir/Makefile" ; then \
-			cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) $$target; else\
-			cd $$moddir && MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\
+			test -f "$$buildmoddir/Makefile" || cp $$moddir/Makefile $$buildmoddir/Makefile ; \
+			cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_srcdir) $(MAKE) $(AM_MAKEFLAGS) $$target; \
+		else\
+			cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_srcdir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\
 		fi;) || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
 	fi; \
 	test -z "$$fail" ;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_cidlookup/mod_cidlookup.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -48,6 +48,8 @@
 
 static struct {
 	char *url;
+	int curl_timeout;
+	int curl_warnduration;
 	
 	char *whitepages_apikey;
 
@@ -55,12 +57,12 @@
 	int cache_expire;
 	
 	char *odbc_dsn;
+	char *odbc_user;
+	char *odbc_pass;
 	char *sql;
 	char *citystate_sql;
 
-	switch_mutex_t *db_mutex;
 	switch_memory_pool_t *pool;
-	switch_odbc_handle_t *master_odbc;
 } globals;
 
 struct http_data {
@@ -84,71 +86,62 @@
 };
 typedef struct callback_obj callback_t;
 
-
 static switch_event_node_t *reload_xml_event = NULL;
 
+static switch_cache_db_handle_t *cidlookup_get_db_handle(void)
+{
+	switch_cache_db_connection_options_t options = { {0} };
+	switch_cache_db_handle_t *dbh = NULL;
+	
+	if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
+		options.odbc_options.dsn = globals.odbc_dsn;
+		options.odbc_options.user = globals.odbc_user;
+		options.odbc_options.pass = globals.odbc_pass;
+
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+	}
+	return dbh;
+}
+
+
 static switch_status_t config_callback_dsn(switch_xml_config_item_t *data, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	char *odbc_user = NULL;
-	char *odbc_pass = NULL;
-	char *odbc_dsn = NULL;
 	
-	switch_odbc_handle_t *odbc = NULL;
+	switch_cache_db_handle_t *dbh = NULL;
 
 	if (!switch_odbc_available()) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC is not compiled in.  Do not configure odbc-dsn parameter!\n");
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (globals.db_mutex) {
-		switch_mutex_lock(globals.db_mutex);
-	}
-	
 	if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && changed) {
 
 		if(zstr(newvalue)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No local database defined.\n");
 		} else {
-			odbc_dsn = strdup(newvalue);
-			if ((odbc_user = strchr(odbc_dsn, ':'))) {
-				*odbc_user++ = '\0';
-				if ((odbc_pass = strchr(odbc_user, ':'))) {
-					*odbc_pass++ = '\0';
+			switch_safe_free(globals.odbc_dsn);
+			globals.odbc_dsn = strdup(newvalue);
+			if ((globals.odbc_user = strchr(globals.odbc_dsn, ':'))) {
+				*globals.odbc_user++ = '\0';
+				if ((globals.odbc_pass = strchr(globals.odbc_user, ':'))) {
+					*globals.odbc_pass++ = '\0';
 				}
 			}
 
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connecting to dsn: %s\n", globals.odbc_dsn);
-			
-			/* setup dsn */
-			
-			if (!(odbc = switch_odbc_handle_new(odbc_dsn, odbc_user, odbc_pass))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connecting to dsn: %s\n", globals.odbc_dsn);
+
+			if (!(dbh = cidlookup_get_db_handle())) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
 				switch_goto_status(SWITCH_STATUS_FALSE, done);
 			}
-			if (switch_odbc_handle_connect(odbc) != SWITCH_ODBC_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-				switch_goto_status(SWITCH_STATUS_FALSE, done);
-			}
 		}
-		
-		/* ok, we have a new connection, tear down old one */
-		if (globals.master_odbc) {
-			switch_odbc_handle_disconnect(globals.master_odbc);
-			switch_odbc_handle_destroy(&globals.master_odbc);
-		}
-		
-		/* and swap in new connection */
-		globals.master_odbc = odbc;
 	}
 
 	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
 	
 done:
-	if (globals.db_mutex) {
-		switch_mutex_unlock(globals.db_mutex);
-	}
-	switch_safe_free(odbc_dsn);
+	switch_cache_db_release_db_handle(&dbh);
 	return status;
 }
 
@@ -159,6 +152,8 @@
 	SWITCH_CONFIG_ITEM_STRING_STRDUP("whitepages-apikey", CONFIG_RELOAD, &globals.whitepages_apikey, NULL, "api key for whitepages.com", "api key for whitepages.com"),
 	SWITCH_CONFIG_ITEM("cache", SWITCH_CONFIG_BOOL, CONFIG_RELOAD, &globals.cache, SWITCH_FALSE, NULL, "true|false", "whether to cache via cidlookup"),
 	SWITCH_CONFIG_ITEM("cache-expire", SWITCH_CONFIG_INT, CONFIG_RELOAD, &globals.cache_expire, (void *)300, NULL, "expire", "seconds to preserve num->name cache"),
+	SWITCH_CONFIG_ITEM("curl-timeout", SWITCH_CONFIG_INT, CONFIG_RELOAD, &globals.curl_timeout, (void *)2000, NULL, "timeout for curl", "milliseconds to timeout"),
+	SWITCH_CONFIG_ITEM("curl-warning-duration", SWITCH_CONFIG_INT, CONFIG_RELOAD, &globals.curl_warnduration, (void *)1000, NULL, "warning when curl queries are longer than specified time", "milliseconds"),
 	SWITCH_CONFIG_ITEM_STRING_STRDUP("sql", CONFIG_RELOAD, &globals.sql, NULL, "sql whre number=${caller_id_number}", "SQL to run if overriding CID"),
 	SWITCH_CONFIG_ITEM_STRING_STRDUP("citystate-sql", CONFIG_RELOAD, &globals.citystate_sql, NULL, "sql to look up city/state info", "SQL to run if overriding CID"),
 	SWITCH_CONFIG_ITEM_CALLBACK("odbc-dsn", SWITCH_CONFIG_STRING, CONFIG_RELOAD, &globals.odbc_dsn, "", config_callback_dsn, &config_opt_dsn,
@@ -180,20 +175,23 @@
 	do_config(SWITCH_TRUE);
 }
 
-static switch_bool_t cidlookup_execute_sql_callback(char *sql, switch_core_db_callback_func_t callback, void *pdata)
+static switch_bool_t cidlookup_execute_sql_callback(char *sql, switch_core_db_callback_func_t callback, callback_t *cbt, char **err)
 {
 	switch_bool_t retval = SWITCH_FALSE;
+	switch_cache_db_handle_t *dbh = NULL;
 	
-	switch_mutex_lock(globals.db_mutex);
-	if (globals.odbc_dsn) {
-		if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata, NULL)
+	if (globals.odbc_dsn && (dbh = cidlookup_get_db_handle())) {
+		if (switch_cache_db_execute_sql_callback(dbh, sql, callback, (void *)cbt, err)
 				== SWITCH_ODBC_FAIL) {
 			retval = SWITCH_FALSE;
 		} else {
 			retval = SWITCH_TRUE;
 		}
+	} else {
+		*err = switch_core_sprintf(cbt->pool, "Unable to get ODBC handle.  dsn: %s, dbh is %s\n", globals.odbc_dsn, dbh ? "not null" : "null");
 	}
-	switch_mutex_unlock(globals.db_mutex);
+	
+	switch_cache_db_release_db_handle(&dbh);
 	return retval;
 }
 
@@ -361,7 +359,8 @@
 
 static char *do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, const char *query) {
 	char *name = NULL;
-	
+	switch_time_t start_time = switch_micro_time_now();
+	switch_time_t time_diff = 0;
 	CURL *curl_handle = NULL;
 	long httpRes = 0;
 	char hostname[256] = "";
@@ -385,6 +384,14 @@
 	curl_easy_setopt(curl_handle, CURLOPT_POST, SWITCH_FALSE);
 	curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
 	curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
+	/*
+	 TIMEOUT_MS is introduced in 7.16.2, we have 7.16.0 in tree 
+	 */
+#ifdef CURLOPT_TIMEOUT_MS
+	curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT_MS, globals.curl_timeout);
+#else
+	curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.curl_timeout/1000);
+#endif
 	curl_easy_setopt(curl_handle, CURLOPT_URL, query);
 	curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
 	curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &http_data);
@@ -405,6 +412,22 @@
 		}
 	}
 	
+	time_diff = (switch_micro_time_now() - start_time); /* convert to milli from micro */
+	
+	if ((time_diff/1000) >= globals.curl_warnduration) {
+		switch_core_time_duration_t duration;
+		switch_core_measure_time(time_diff, &duration);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SLOW LOOKUP ("
+			"%um, "
+			"%us, "
+			"%ums"
+			"): url: %s\n", 
+			duration.min,
+			duration.sec,
+			duration.ms,
+			query);
+	}
+	
 	switch_safe_free(http_data.stream.data);
 	return name;
 }
@@ -492,16 +515,17 @@
 static char *do_db_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num, const char *sql) {
 	char *name = NULL;
 	char *newsql = NULL;
+	char *err = NULL;
 	callback_t cbt = { 0 };
 	cbt.pool = pool;
 	
-	if (globals.master_odbc) {
+	if (globals.odbc_dsn) {
 		newsql = switch_event_expand_headers(event, sql);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", newsql);
-		if (cidlookup_execute_sql_callback(newsql, cidlookup_callback, &cbt)) {
+		if (cidlookup_execute_sql_callback(newsql, cidlookup_callback, &cbt, &err)) {
 			name = cbt.name;
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to lookup cid\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to lookup cid: %s\n", err ? err : "(null)");
 		}
 	}
 	if (newsql != globals.sql) {
@@ -524,7 +548,7 @@
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "caller_id_number", number);
 
 	/* database always wins */
-	if (switch_odbc_available() && globals.master_odbc && globals.sql) {
+	if (switch_odbc_available() && globals.odbc_dsn && globals.sql) {
 		name = do_db_lookup(pool, event, number, globals.sql);
 		if (name) {
 			cid->name = name;
@@ -572,7 +596,7 @@
 	if (!cid->area &&
 		!skipcitystate && 
 		strlen(number) == 11 && number[0] == '1' &&
-		switch_odbc_available() && globals.master_odbc && globals.citystate_sql) {
+		switch_odbc_available() && globals.odbc_dsn && globals.citystate_sql) {
 		
 		/* yes, this is really area */
 		name = do_db_lookup(pool, event, number, globals.citystate_sql);
@@ -713,6 +737,9 @@
 									globals.url ? globals.url : "(null)",
 									(globals.cache) ? "true" : "false",
 									globals.cache_expire);
+			stream->write_function(stream, " curl-timeout: %" SWITCH_TIME_T_FMT "\n curl-warn-duration: %" SWITCH_TIME_T_FMT "\n", 
+									globals.curl_timeout,
+									globals.curl_warnduration);
 									
 			stream->write_function(stream, " odbc-dsn: %s\n sql: %s\n citystate-sql: %s\n", 
 									globals.odbc_dsn ? globals.odbc_dsn : "(null)",
@@ -771,12 +798,6 @@
 	
 	globals.pool = pool;
 
-	if (switch_odbc_available() && !globals.db_mutex) {
-		if (switch_mutex_init(&globals.db_mutex, SWITCH_MUTEX_UNNESTED, globals.pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to initialize db_mutex\n");
-		}
-	}
-
 	do_config(SWITCH_FALSE);
 	
 	if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &reload_xml_event) != SWITCH_STATUS_SUCCESS)) {
@@ -797,16 +818,7 @@
   Macro expands to: switch_status_t mod_cidlookup_shutdown() */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown)
 {
-	/* Cleanup dynamically allocated config settings */
 
-	if (globals.db_mutex) {
-		switch_mutex_destroy(globals.db_mutex);
-	}
-	if (globals.master_odbc) {
-		switch_odbc_handle_disconnect(globals.master_odbc);
-		switch_odbc_handle_destroy(&globals.master_odbc);
-	}
-
 	switch_event_unbind(&reload_xml_event);
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_commands/mod_commands.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_commands/mod_commands.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_commands/mod_commands.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -53,7 +53,35 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_STANDARD_API(db_cache_function) {
+	int argc;
+	char *mydata = NULL, *argv[2];
 
+	if (zstr(cmd)) {
+		goto error;
+	}
+	
+	mydata = strdup(cmd);
+	switch_assert(mydata);
+
+	argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+
+	if (argc < 1) {
+		goto error;
+	}
+	if (argv[0] && switch_stristr("status", argv[0])) {
+		switch_cache_db_status(stream);
+		goto ok;
+	} else {
+		goto error;
+	}
+	
+error:
+		stream->write_function(stream, "%s", "parameter missing\n");
+ok:
+		return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_STANDARD_API(host_lookup_function)
 {
 	char host[256] = "";
@@ -3827,6 +3855,8 @@
 	SWITCH_ADD_API(commands_api_interface, "nat_map", "nat_map", nat_map_function, "[status|republish|reinit] | [add|del] <port> [tcp|udp] [static]");
 	SWITCH_ADD_API(commands_api_interface, "host_lookup", "host_lookup", host_lookup_function, "<hostname>");
 	SWITCH_ADD_API(commands_api_interface, "hostname", "Returns the system hostname", hostname_api_function, "");
+	SWITCH_ADD_API(commands_api_interface, "db_cache", "db cache management", db_cache_function, "status");
+	switch_console_set_complete("db_cache status");
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_NOUNLOAD;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_lcr/mod_lcr.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_lcr/mod_lcr.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_lcr/mod_lcr.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -148,9 +148,9 @@
 	switch_memory_pool_t *pool;
 	char *dbname;
 	char *odbc_dsn;
+	char *odbc_user;
+	char *odbc_pass;
 	switch_mutex_t *mutex;
-	switch_mutex_t *db_mutex;
-	switch_odbc_handle_t *master_odbc;
 	switch_hash_t *profile_hash;
 	profile_t *default_profile;
 	void *filler1;
@@ -389,15 +389,34 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_cache_db_handle_t *lcr_get_db_handle(void)
+{
+	switch_cache_db_connection_options_t options = { {0} };
+	switch_cache_db_handle_t *dbh = NULL;
+	
+	if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
+		options.odbc_options.dsn = globals.odbc_dsn;
+		options.odbc_options.user = globals.odbc_user;
+		options.odbc_options.pass = globals.odbc_pass;
+
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+	}
+	return dbh;
+}
+
 static switch_bool_t db_check(char *sql)
 {
-	if (globals.odbc_dsn) {
-		if (switch_odbc_handle_exec(globals.master_odbc, sql, NULL) == SWITCH_ODBC_SUCCESS) {
-			return SWITCH_TRUE;
+	switch_bool_t ret = SWITCH_FALSE;
+	switch_cache_db_handle_t *dbh = NULL;
+
+	if (globals.odbc_dsn && (dbh = lcr_get_db_handle())) {
+		if (switch_cache_db_execute_sql(dbh, sql, NULL) == SWITCH_ODBC_SUCCESS) {
+			ret = SWITCH_TRUE;
 		}
 	}
-	
-	return SWITCH_FALSE;
+
+	switch_cache_db_release_db_handle(&dbh);
+	return ret;
 }
 
 /* try each type of random until we suceed */
@@ -523,17 +542,17 @@
 static switch_bool_t lcr_execute_sql_callback(char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
 	switch_bool_t retval = SWITCH_FALSE;
+	switch_cache_db_handle_t *dbh = NULL;
 	
-	switch_mutex_lock(globals.db_mutex);
-	if (globals.odbc_dsn) {
-		if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata, NULL)
+	if (globals.odbc_dsn && (dbh = lcr_get_db_handle())) {
+		if (switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, NULL)
 				== SWITCH_ODBC_FAIL) {
 			retval = SWITCH_FALSE;
 		} else {
 			retval = SWITCH_TRUE;
 		}
 	}
-	switch_mutex_unlock(globals.db_mutex);
+	switch_cache_db_release_db_handle(&dbh);
 	return retval;
 }
 
@@ -847,9 +866,8 @@
 	switch_stream_handle_t sql_stream = { 0 };
 	switch_xml_t cfg, xml, settings, param, x_profile, x_profiles;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	char *odbc_user = NULL;
-	char *odbc_pass = NULL;
 	profile_t *profile = NULL;
+	switch_cache_db_handle_t *dbh = NULL;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
@@ -864,11 +882,12 @@
 			val = (char *) switch_xml_attr_soft(param, "value");
 			if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "odbc_dsn is %s\n", val);
-				globals.odbc_dsn = switch_core_strdup(globals.pool, val);
-				if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
-					*odbc_user++ = '\0';
-					if ((odbc_pass = strchr(odbc_user, ':'))) {
-						*odbc_pass++ = '\0';
+				switch_safe_free(globals.odbc_dsn);
+				globals.odbc_dsn = strdup(val);
+				if ((globals.odbc_user = strchr(globals.odbc_dsn, ':'))) {
+					*globals.odbc_user++ = '\0';
+					if ((globals.odbc_pass = strchr(globals.odbc_user, ':'))) {
+						*globals.odbc_pass++ = '\0';
 					}
 				}
 			}
@@ -877,20 +896,14 @@
 	
 	/* initialize sql here, 'cause we need to verify custom_sql for each profile below */
 	if (globals.odbc_dsn) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO
-						  , "dsn is \"%s\", user is \"%s\", and password is \"%s\"\n"
-						  , globals.odbc_dsn, odbc_user, odbc_pass
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG
+						  , "dsn is \"%s\", user is \"%s\"\n"
+						  , globals.odbc_dsn, globals.odbc_user
 						  );
-		if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
+		if (!(dbh = lcr_get_db_handle())) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-			status = SWITCH_STATUS_FALSE;
-			goto done;
+			switch_goto_status(SWITCH_STATUS_FALSE, done);
 		}
-		if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-			status = SWITCH_STATUS_FALSE;
-			goto done;
-		}
 	}
 	
 	if (set_db_random() == SWITCH_TRUE) {
@@ -1089,7 +1102,8 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting system defined default profile.");
 	}
 
-	done:
+done:
+	switch_cache_db_release_db_handle(&dbh);
 	switch_xml_free(xml);
 	return status;
 }
@@ -1549,10 +1563,6 @@
 	if (switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to initialize mutex\n");
 	}
-	if (switch_mutex_init(&globals.db_mutex, SWITCH_MUTEX_UNNESTED, globals.pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to initialize db_mutex\n");
-	}
-
 	if (lcr_load_config() != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load lcr config file\n");
 		return SWITCH_STATUS_FALSE;
@@ -1571,8 +1581,6 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lcr_shutdown)
 {
 
-	switch_odbc_handle_disconnect(globals.master_odbc);
-	switch_odbc_handle_destroy(&globals.master_odbc);
 	switch_core_hash_destroy(&globals.profile_hash);
 
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_limit/mod_limit.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_limit/mod_limit.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_limit/mod_limit.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -47,12 +47,13 @@
 	char hostname[256];
 	char *dbname;
 	char *odbc_dsn;
+	char *odbc_user;
+	char *odbc_pass;
 	switch_mutex_t *mutex;
 	switch_mutex_t *limit_hash_mutex;
 	switch_hash_t *limit_hash;	
 	switch_mutex_t *db_hash_mutex;
 	switch_hash_t *db_hash;	
-	switch_odbc_handle_t *master_odbc;
 } globals;
 
 typedef struct  {
@@ -88,38 +89,47 @@
 	"   url        VARCHAR(255)\n"
 	");\n";
 
+
+switch_cache_db_handle_t *limit_get_db_handle(void)
+{
+	switch_cache_db_connection_options_t options = { {0} };
+	switch_cache_db_handle_t *dbh = NULL;
+	
+	if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
+		options.odbc_options.dsn = globals.odbc_dsn;
+		options.odbc_options.user = globals.odbc_user;
+		options.odbc_options.pass = globals.odbc_pass;
+
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+		return dbh;
+	} else {
+		options.core_db_options.db_path = globals.dbname;
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+		return dbh;
+	}
+}
+
+
 static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
 {
-	switch_core_db_t *db;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_cache_db_handle_t *dbh = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
-	if (switch_odbc_available() && globals.odbc_dsn) {
-		switch_odbc_statement_handle_t stmt;
-		if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
-			char *err_str;
-			err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
-			if (!zstr(err_str)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
-			}
-			switch_safe_free(err_str);
-			status = SWITCH_STATUS_FALSE;
-		}
-		switch_odbc_statement_handle_free(&stmt);
-	} else {
-		if (!(db = switch_core_db_open_file(globals.dbname))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
-			status = SWITCH_STATUS_FALSE;
-			goto end;
-		}
-		status = switch_core_db_persistant_execute(db, sql, 1);
-		switch_core_db_close(db);
+	if (!(dbh = limit_get_db_handle())) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+		goto end;
 	}
 
+	status = switch_cache_db_execute_sql(dbh, sql, NULL);
+
   end:
+	
+	switch_cache_db_release_db_handle(&dbh);
+
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -130,34 +140,29 @@
 static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
 	switch_bool_t ret = SWITCH_FALSE;
-	switch_core_db_t *db;
 	char *errmsg = NULL;
-
+	switch_cache_db_handle_t *dbh = NULL;
+	
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
-	if (switch_odbc_available() && globals.odbc_dsn) {
-		switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata, NULL);
-	} else {
-		if (!(db = switch_core_db_open_file(globals.dbname))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
-			goto end;
-		}
+	if (!(dbh = limit_get_db_handle())) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+        goto end;
+    }
+	
+	switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, &errmsg);
 
-		switch_core_db_exec(db, sql, callback, pdata, &errmsg);
-
-		if (errmsg) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
-			free(errmsg);
-		}
-
-		if (db) {
-			switch_core_db_close(db);
-		}
+	if (errmsg) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
+		free(errmsg);
 	}
 
   end:
+
+	switch_cache_db_release_db_handle(&dbh);
+
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -165,6 +170,7 @@
 	return ret;
 }
 
+
 static switch_xml_config_string_options_t limit_config_dsn = { NULL, 0, "[^:]+:[^:]+:.+" };
 
 static switch_xml_config_item_t config_settings[] = {
@@ -175,10 +181,8 @@
 
 static switch_status_t do_config()
 {
-	switch_core_db_t *db;
+	switch_cache_db_handle_t *dbh;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	char *odbc_user = NULL;
-	char *odbc_pass = NULL;
 	char *sql = NULL;
 	
 	limit_config_dsn.pool = globals.pool;
@@ -187,24 +191,28 @@
 		return SWITCH_STATUS_TERM;
 	}
 	
-	if (switch_odbc_available() && globals.odbc_dsn) {
-		if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
-			*odbc_user++ = '\0';
-			if ((odbc_pass = strchr(odbc_user, ':'))) {
-				*odbc_pass++ = '\0';
+	if (globals.odbc_dsn) {
+		if ((globals.odbc_user = strchr(globals.odbc_dsn, ':'))) {
+			*globals.odbc_user++ = '\0';
+			if ((globals.odbc_pass = strchr(globals.odbc_user, ':'))) {
+				*globals.odbc_pass++ = '\0';
 			}
 		}
-	} else if (globals.odbc_dsn) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
+
+		if (!(dbh = limit_get_db_handle())) {
+			globals.odbc_dsn = globals.odbc_user = globals.odbc_pass;
+		}
 	}
 	
 
-	if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
+	if (zstr(globals.odbc_dsn) || zstr(globals.odbc_user) || zstr(globals.odbc_pass)) {
 		globals.dbname = "call_limit";
+		dbh = limit_get_db_handle();
 	}
 
-	if (switch_odbc_available() && globals.odbc_dsn) {
-		int x;
+
+	if (dbh) {
+		int x = 0;
 		char *indexes[] = {
 			"create index ld_hostname on limit_data (hostname)",
 			"create index ld_uuid on limit_data (uuid)",
@@ -216,71 +224,24 @@
 			"create index gd_url on group_data (url)",
 			NULL
 		};
+
 		
 
-
-		if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-			status = SWITCH_STATUS_FALSE;
-			goto done;
-		}
-		if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-			status = SWITCH_STATUS_FALSE;
-			goto done;
-		}
-
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.odbc_dsn);
-		if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from limit_data", NULL) != SWITCH_STATUS_SUCCESS) {
-			if (switch_odbc_handle_exec(globals.master_odbc, limit_sql, NULL) != SWITCH_STATUS_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
-			}
-		}
-		if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from db_data", NULL) != SWITCH_STATUS_SUCCESS) {
-			if (switch_odbc_handle_exec(globals.master_odbc, db_sql, NULL) != SWITCH_STATUS_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
-			}
-		}
-		if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from group_data", NULL) != SWITCH_STATUS_SUCCESS) {
-			if (switch_odbc_handle_exec(globals.master_odbc, group_sql, NULL) != SWITCH_STATUS_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
-			}
-		}
-
+		switch_cache_db_test_reactive(dbh, "select * from limit_data", NULL, limit_sql);
+		switch_cache_db_test_reactive(dbh, "select * from db_data", NULL, db_sql);
+		switch_cache_db_test_reactive(dbh, "select * from group_data", NULL, group_sql);
+		
 		for (x = 0; indexes[x]; x++) {
-			switch_odbc_handle_exec(globals.master_odbc, indexes[x], NULL);
+			switch_cache_db_execute_sql(dbh, indexes[x], NULL);
 		}
-	} else {
-		if ((db = switch_core_db_open_file(globals.dbname))) {
-			switch_core_db_test_reactive(db, "select * from limit_data", NULL, limit_sql);
-			switch_core_db_test_reactive(db, "select * from db_data", NULL, db_sql);
-			switch_core_db_test_reactive(db, "select * from group_data", NULL, group_sql);
-			
-			switch_core_db_exec(db, "create index if not exists ld_hostname on limit_data (hostname)", NULL, NULL, NULL);
-			switch_core_db_exec(db, "create index if not exists ld_uuid on limit_data (uuid)", NULL, NULL, NULL);
-			switch_core_db_exec(db, "create index if not exists ld_realm on limit_data (realm)", NULL, NULL, NULL);
-			switch_core_db_exec(db, "create index if not exists ld_id on limit_data (id)", NULL, NULL, NULL);
+	
+		switch_cache_db_release_db_handle(&dbh);
 
-			switch_core_db_exec(db, "create index if not exists dd_realm on db_data (realm)", NULL, NULL, NULL);
-			switch_core_db_exec(db, "create index if not exists dd_data_key on db_data (data_key)", NULL, NULL, NULL);
-
-			switch_core_db_exec(db, "create index if not exists gd_groupname on group_data (groupname)", NULL, NULL, NULL);
-			switch_core_db_exec(db, "create index if not exists gd_url on group_data (url)", NULL, NULL, NULL);
-
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
-			status = SWITCH_STATUS_FALSE;
-			goto done;
-		}
-		switch_core_db_close(db);
+		sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname);
+		limit_execute_sql(sql, globals.mutex);
+		switch_safe_free(sql);
 	}
 
-  done:
-
-	sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname);
-	limit_execute_sql(sql, globals.mutex);
-	switch_safe_free(sql);
-
 	return status;
 }
 
@@ -1719,10 +1680,6 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_limit_shutdown) 
 {
 	
-	if (globals.master_odbc) {
-		switch_odbc_handle_destroy(&globals.master_odbc);
-	}
-	
 	switch_event_free_subclass(LIMIT_EVENT_USAGE);
 	
 	switch_xml_config_cleanup(config_settings);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_voicemail/mod_voicemail.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_voicemail/mod_voicemail.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/applications/mod_voicemail/mod_voicemail.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -142,7 +142,6 @@
 	uint32_t record_threshold;
 	uint32_t record_silence_hits;
 	uint32_t record_sample_rate;
-	switch_odbc_handle_t *master_odbc;
 	switch_bool_t auto_playback_recordings;
 	switch_thread_rwlock_t *rwlock;
 	switch_memory_pool_t *pool;
@@ -153,81 +152,89 @@
 };
 typedef struct vm_profile vm_profile_t;
 
+
+switch_cache_db_handle_t *vm_get_db_handle(vm_profile_t *profile)
+{
+	switch_cache_db_connection_options_t options = { {0} };
+	switch_cache_db_handle_t *dbh = NULL;
+	
+	if (profile->odbc_dsn && profile->odbc_user && profile->odbc_pass) {
+		options.odbc_options.dsn = profile->odbc_dsn;
+		options.odbc_options.user = profile->odbc_user;
+		options.odbc_options.pass = profile->odbc_pass;
+
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+		return dbh;
+	} else {
+		options.core_db_options.db_path = profile->dbname;
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+		return dbh;
+	}
+}
+
+
 static switch_status_t vm_execute_sql(vm_profile_t *profile, char *sql, switch_mutex_t *mutex)
 {
-	switch_core_db_t *db;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_cache_db_handle_t *dbh = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
-	if (switch_odbc_available() && profile->odbc_dsn) {
-		switch_odbc_statement_handle_t stmt;
-		if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
-			char *err_str;
-			err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
-			switch_safe_free(err_str);
-			status = SWITCH_STATUS_FALSE;
-		}
-		switch_odbc_statement_handle_free(&stmt);
-	} else {
-		if (!(db = switch_core_db_open_file(profile->dbname))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
-			status = SWITCH_STATUS_FALSE;
-			goto end;
-		}
-		status = switch_core_db_persistant_execute(db, sql, 1);
-		switch_core_db_close(db);
+	if (!(dbh = vm_get_db_handle(profile))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+		goto end;
 	}
 
+	status = switch_cache_db_execute_sql(dbh, sql, NULL);
+
   end:
+	
+	switch_cache_db_release_db_handle(&dbh);
+
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
+
 	return status;
 }
 
-
 static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
 	switch_bool_t ret = SWITCH_FALSE;
-	switch_core_db_t *db;
 	char *errmsg = NULL;
-
+	switch_cache_db_handle_t *dbh = NULL;
+	
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
-	if (switch_odbc_available() && profile->odbc_dsn) {
-		switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata, NULL);
-	} else {
-		if (!(db = switch_core_db_open_file(profile->dbname))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
-			goto end;
-		}
+	if (!(dbh = vm_get_db_handle(profile))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+        goto end;
+    }
+	
+	switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, &errmsg);
 
-		switch_core_db_exec(db, sql, callback, pdata, &errmsg);
-
-		if (errmsg) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
-			free(errmsg);
-		}
-
-		if (db) {
-			switch_core_db_close(db);
-		}
+	if (errmsg) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
+		free(errmsg);
 	}
 
   end:
+
+	switch_cache_db_release_db_handle(&dbh);
+
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
+
 	return ret;
 }
 
 
+
 static char vm_sql[] =
 	"CREATE TABLE voicemail_msgs (\n"
 	"   created_epoch INTEGER,\n"
@@ -268,10 +275,6 @@
 static void free_profile(vm_profile_t *profile)
 {
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
-	if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Closing ODBC Database! %s\n", profile->name);
-		switch_odbc_handle_destroy(&profile->master_odbc);
-	}
 	switch_core_destroy_memory_pool(&profile->pool);
 }
 
@@ -607,6 +610,7 @@
 	vm_profile_t *profile = NULL;
 	switch_xml_t x_profiles, x_profile, cfg, xml, x_email, param;
 	switch_event_t *event = NULL;
+	switch_cache_db_handle_t *dbh;
 
 	if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf);
@@ -618,8 +622,8 @@
 
 	if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile_name))) {
 		switch_memory_pool_t *pool;
-		switch_core_db_t *db = NULL;
 		int x, count;
+		char *errmsg;
 
 		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
@@ -679,96 +683,23 @@
 		}
 
 		profile->dbname = switch_core_sprintf(profile->pool, "voicemail_%s", profile_name);
-		if (switch_odbc_available() && profile->odbc_dsn) {
-			if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-				goto end;
 
-			}
-			if (switch_odbc_handle_connect(profile->master_odbc) != SWITCH_ODBC_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-				goto end;
-			}
-
-			if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_msgs", NULL) != SWITCH_ODBC_SUCCESS) {
-				switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_msgs", NULL);
-				switch_odbc_handle_exec(profile->master_odbc, vm_sql, NULL);
-			}
-
-			if (switch_odbc_handle_exec(profile->master_odbc, "select count(username) from voicemail_prefs", NULL) != SWITCH_ODBC_SUCCESS) {
-				switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_prefs", NULL);
-				switch_odbc_handle_exec(profile->master_odbc, vm_pref_sql, NULL);
-			}
-
-			if (switch_odbc_handle_exec(profile->master_odbc, "select count(password) from voicemail_prefs", NULL) != SWITCH_ODBC_SUCCESS) {
-				switch_odbc_handle_exec(profile->master_odbc, "alter table voicemail_prefs add password varchar(255)", NULL);
-			}
-
-			if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_data", NULL) == SWITCH_ODBC_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Old table voicemail_data found, migrating data!\n");
-				/* XXX: Old table found.. migrating data into new table */
-				if (switch_odbc_handle_exec(profile->master_odbc,
-											"insert into voicemail_msgs (created_epoch, read_epoch, username, domain, uuid, cid_name, cid_number, "
-											"in_folder, file_path, message_len, flags, read_flags) "
-											"select created_epoch, read_epoch, user, domain, uuid, "
-											"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
-											NULL) != SWITCH_ODBC_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to migrate old voicemail_data to voicemail_msgs!\n");
-					goto end;
-				}
-				switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_data", NULL);
-			}
-
-			for (x = 0; vm_index_list[x]; x++) {
-				switch_odbc_handle_exec(profile->master_odbc, vm_index_list[x], NULL);
-			}
-		} else {
-			if ((db = switch_core_db_open_file(profile->dbname))) {
-				char *errmsg;
-				switch_core_db_test_reactive(db, "select count(message_len) from voicemail_msgs", "drop table voicemail_msgs", vm_sql);
-
-				switch_core_db_exec(db, "select count(message_len) from voicemail_data", NULL, NULL, &errmsg);
-				if (errmsg) {
-					switch_core_db_free(errmsg);
-					errmsg = NULL;
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Migrating data from voicemail_data to voicemail_msgs!\n");
-					switch_core_db_exec(db, "insert into voicemail_msgs (created_epoch, read_epoch, username, domain, uuid, cid_name, cid_number, "
-										"in_folder, file_path, message_len, flags, read_flags) "
-										"select created_epoch, read_epoch, user, domain, uuid, "
-										"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
-										NULL, NULL, &errmsg);
-					if (errmsg) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
-						switch_core_db_free(errmsg);
-						errmsg = NULL;
-					}
-					switch_core_db_exec(db, "drop table voicemail_data", NULL, NULL, &errmsg);
-					if (errmsg) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
-						switch_core_db_free(errmsg);
-						errmsg = NULL;
-					}
-				}
-
-
-				switch_core_db_test_reactive(db, "select count(username) from voicemail_prefs", "drop table voicemail_prefs", vm_pref_sql);
-				switch_core_db_test_reactive(db, "select count(password) from voicemail_prefs", NULL, 
-												 "alter table voicemail_prefs add password varchar(255)");
-
-				for (x = 0; vm_index_list[x]; x++) {
-					errmsg = NULL;
-					switch_core_db_exec(db, vm_index_list[x], NULL, NULL, &errmsg);
-					switch_safe_free(errmsg);
-				}
-
-			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
-				goto end;
-			}
-			switch_core_db_close(db);
+		if (!(dbh = vm_get_db_handle(profile))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n");
+			goto end;
 		}
+		
+		switch_cache_db_test_reactive(dbh, "select count(message_len) from voicemail_msgs", "drop table voicemail_msgs", vm_sql);
+		switch_cache_db_test_reactive(dbh, "select count(username) from voicemail_prefs", "drop table voicemail_prefs", vm_pref_sql);
+		switch_cache_db_test_reactive(dbh, "select count(password) from voicemail_prefs", NULL, "alter table voicemail_prefs add password varchar(255)");
+		
+		for (x = 0; vm_index_list[x]; x++) {
+			errmsg = NULL;
+			switch_cache_db_execute_sql(dbh, vm_index_list[x], &errmsg);
+			switch_safe_free(errmsg);
+		}
 
+		switch_cache_db_release_db_handle(&dbh);
 
 		switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, profile->pool);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added Profile %s\n", profile->name);
@@ -776,6 +707,7 @@
 	}
 
   end:
+	switch_cache_db_release_db_handle(&dbh);
 	if (xml) {
 		switch_xml_free(xml);
 	}
@@ -1058,6 +990,38 @@
 };
 typedef struct callback callback_t;
 
+struct msg_cnt_callback {
+	char *buf;
+	size_t len;
+	int matches;
+	int total_new_messages;
+	int total_new_urgent_messages;
+	int total_saved_messages;
+	int total_saved_urgent_messages;
+};
+typedef struct msg_cnt_callback msg_cnt_callback_t;
+
+
+static int message_count_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	msg_cnt_callback_t *cbt = (msg_cnt_callback_t *) pArg;
+	if (atoi(argv[0]) == 1) { /* UnRead */
+		if (!strcasecmp(argv[1], "A_URGENT")) { /* Urgent */
+			cbt->total_new_urgent_messages = atoi(argv[2]);
+		} else { /* Normal */
+			cbt->total_new_messages = atoi(argv[2]);
+		}
+	} else { /* Already Read */
+		if (!strcasecmp(argv[1], "A_URGENT")) { /* Urgent */
+			cbt->total_saved_urgent_messages = atoi(argv[2]);
+		} else { /* Normal */
+			cbt->total_saved_messages = atoi(argv[2]);
+		}
+	}
+
+	return 0;
+}
+
 static int sql2str_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	callback_t *cbt = (callback_t *) pArg;
@@ -1290,42 +1254,35 @@
 	return ret;
 }
 
-static void message_count(vm_profile_t *profile, const char *id_in, const char *domain_name, const char *myfolder,
-						  int *total_new_messages, int *total_saved_messages, int *total_new_urgent_messages, int *total_saved_urgent_messages)
+static void message_count(vm_profile_t *profile, const char *id_in, const char *domain_name, const char *myfolder, int *total_new_messages, 
+		int *total_saved_messages, int *total_new_urgent_messages, int *total_saved_urgent_messages)
 {
 	char msg_count[80] = "";
-	callback_t cbt = { 0 };
+	msg_cnt_callback_t cbt = { 0 };
 	char sql[256];
 	char *myid = NULL;
 
+
 	cbt.buf = msg_count;
 	cbt.len = sizeof(msg_count);
-	
+
+	cbt.total_new_messages = 0;
+	cbt.total_new_urgent_messages = 0;
+	cbt.total_saved_messages = 0;
+	cbt.total_saved_urgent_messages = 0;
+
 	myid = resolve_id(id_in, domain_name, "message-count");
-	
-	switch_snprintf(sql, sizeof(sql),
-					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0",
-					myid, domain_name, myfolder);
-	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
-	*total_new_messages = atoi(msg_count);
 
 	switch_snprintf(sql, sizeof(sql),
-					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='%s'",
-					myid, domain_name, myfolder, URGENT_FLAG_STRING);
-	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
-	*total_new_urgent_messages = atoi(msg_count);
+					"select read_epoch=0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' group by read_epoch=0,read_flags;",
+						myid, domain_name, myfolder);
 
-	switch_snprintf(sql, sizeof(sql),
-					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0",
-					myid, domain_name, myfolder);
-	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
-	*total_saved_messages = atoi(msg_count);
+	vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt);
 
-	switch_snprintf(sql, sizeof(sql),
-					"select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='%s'",
-					myid, domain_name, myfolder, URGENT_FLAG_STRING);
-	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
-	*total_saved_urgent_messages = atoi(msg_count);
+	*total_new_messages = cbt.total_new_messages + cbt.total_new_urgent_messages;
+	*total_new_urgent_messages = cbt.total_new_urgent_messages;
+	*total_saved_messages = cbt.total_saved_messages + cbt.total_saved_urgent_messages;
+	*total_saved_urgent_messages = cbt.total_saved_urgent_messages;
 
 	if (myid != id_in) {
 		free(myid);
@@ -1471,8 +1428,9 @@
 
 		args.input_callback = cancel_on_dtmf;
 
-		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s:%s", profile->listen_file_key, profile->save_file_key, 
-						profile->delete_file_key, profile->email_key, profile->callback_key, profile->forward_key);
+		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s:%s%s%s", profile->listen_file_key, profile->save_file_key, 
+						profile->delete_file_key, profile->email_key, profile->callback_key, 
+						profile->forward_key, cbt->email ? ":" : "", cbt->email ? cbt->email : "");
 						
 
 		switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want + 1);
@@ -1746,7 +1704,7 @@
 	int total_new_urgent_messages = 0;
 	int total_saved_urgent_messages = 0;
 	int heard_auto_saved = 0, heard_auto_new = 0;
-	char *vm_email = NULL;
+	char *vm_email = NULL, *email_addr = NULL;
 	char *convert_cmd = profile->convert_cmd;
 	char *convert_ext = profile->convert_ext;
 	char *vm_storage_dir = NULL;
@@ -1863,7 +1821,7 @@
 				message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
 							  &total_new_urgent_messages, &total_saved_urgent_messages);
 				memset(&cbt, 0, sizeof(cbt));
-				cbt.email = vm_email;
+				cbt.email = vm_email ? vm_email : email_addr;
 				cbt.convert_cmd = convert_cmd;
 				cbt.convert_ext = convert_ext;
 				cbt.move = VM_MOVE_NEXT;
@@ -2179,6 +2137,9 @@
 						}
 					} else if (!strcasecmp(var, "vm-mailto")) {
 						vm_email = switch_core_session_strdup(session, val);
+						email_addr = switch_core_session_strdup(session, val);
+					} else if (!strcasecmp(var, "email-addr")) {
+						email_addr = switch_core_session_strdup(session, val);
 					} else if (!strcasecmp(var, "vm-convert-cmd")) {
 						convert_cmd = switch_core_session_strdup(session, val);
 					} else if (!strcasecmp(var, "vm-convert-ext")) {
@@ -4157,10 +4118,6 @@
 		
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
 
-		if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Closing ODBC Database! %s\n", profile->name);
-			switch_odbc_handle_destroy(&profile->master_odbc);
-		}
 		switch_core_destroy_memory_pool(&profile->pool);
 		profile = NULL;
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_portaudio/mod_portaudio.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_portaudio/mod_portaudio.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_portaudio/mod_portaudio.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -846,8 +846,8 @@
 	switch_console_set_complete("add pa indev");
 	switch_console_set_complete("add pa outdev");
 	switch_console_set_complete("add pa ringdev");
+	switch_console_set_complete("add pa ringfile");
 	switch_console_set_complete("add pa play");
-	switch_console_set_complete("add pa ringtest");
 	switch_console_set_complete("add pa looptest");
 
 	/* indicate that the module should continue to be loaded */
@@ -1833,6 +1833,7 @@
 		"pa outdev #<num>|<partial name>\n"
 		"pa ringdev #<num>|<partial name>\n"
 		"pa play [ringtest|<filename>]\n"
+		"pa ringfile [filename]\n"
 		"pa looptest\n" "--------------------------------------------------------------------------------\n";
 
 
@@ -2060,6 +2061,27 @@
 			stream->write_function(stream, "Failed to engage audio device\n");
 		}
 		goto done;
+	} else if (!strcasecmp(argv[0], "ringfile")) {
+		if (argv[1]) {
+			if (engage_device(0) == SWITCH_STATUS_SUCCESS) {
+				switch_file_handle_t fh = { 0 };
+				if (switch_core_file_open(&fh,
+							argv[1],
+							globals.read_codec.implementation->number_of_channels,
+							globals.read_codec.implementation->actual_samples_per_second,
+							SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
+					switch_core_file_close(&fh);
+					set_global_ring_file(argv[1]);
+				} else {
+					stream->write_function(stream, "Unable to open ring file %s\n", argv[1]);
+				}
+			} else {
+				stream->write_function(stream, "Failed to engage audio device\n");
+			}
+		} else {
+			stream->write_function(stream, "%s", globals.ring_file);
+		}
+		goto done;
 	}
 
 	if (func) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -89,7 +89,7 @@
 
 
 
-	sockbufsize=SAMPLES_PER_FRAME * 8;
+	sockbufsize=SAMPLES_PER_FRAME * 8 * 3;
 	size = sizeof(int);
 	setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, size);
 
@@ -98,7 +98,7 @@
 	getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
 	DEBUGA_SKYPE("2 SO_RCVBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
 
-	sockbufsize=SAMPLES_PER_FRAME * 8;
+	sockbufsize=SAMPLES_PER_FRAME * 8 * 3;
 	size = sizeof(int);
 	setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, size);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/mod_sofia.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -121,10 +121,12 @@
 static switch_status_t sofia_on_routing(switch_core_session_t *session)
 {
 	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
+	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_assert(tech_pvt != NULL);
 
 	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
 		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+		switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -136,10 +138,12 @@
 static switch_status_t sofia_on_reset(switch_core_session_t *session)
 {
 	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
+	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_assert(tech_pvt != NULL);
 
 	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
 		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+		switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -151,10 +155,12 @@
 static switch_status_t sofia_on_hibernate(switch_core_session_t *session)
 {
 	private_object_t *tech_pvt = switch_core_session_get_private(session);
+	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_assert(tech_pvt != NULL);
 
 	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
 		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+		switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -165,10 +171,12 @@
 static switch_status_t sofia_on_execute(switch_core_session_t *session)
 {
 	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
+	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_assert(tech_pvt != NULL);
 
 	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
 		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+		switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 	}
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
@@ -347,32 +355,6 @@
 		}
 	}
 
-	if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
-		const char *buuid;
-		switch_core_session_t *bsession;
-		switch_channel_t *bchannel;
-		const char *lost_ext;
-
-		if (tech_pvt->max_missed_packets) {
-			switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
-		}
-		switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
-
-		if ((buuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
-			if ((bsession = switch_core_session_locate(buuid))) {
-				bchannel = switch_core_session_get_channel(bsession);
-				if (switch_channel_test_flag(bchannel, CF_BROADCAST)) {
-					if ((lost_ext = switch_channel_get_variable(bchannel, "left_hanging_extension"))) {
-						switch_ivr_session_transfer(bsession, lost_ext, NULL, NULL);
-					}
-					switch_channel_stop_broadcast(bchannel);
-				}
-				switch_core_session_rwunlock(bsession);
-			}
-		}
-		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-	}
-
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel %s hanging up, cause: %s\n",
 					  switch_channel_get_name(channel), switch_channel_cause2str(cause));
 
@@ -665,6 +647,7 @@
 					if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 						sofia_glue_toggle_hold(tech_pvt, 0);
 						sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+						switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 					}
 					switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
 				}
@@ -780,6 +763,7 @@
 					if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 						sofia_glue_toggle_hold(tech_pvt, 0);
 						sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+						switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 					}
 					
 					switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
@@ -1446,6 +1430,7 @@
 	case SWITCH_MESSAGE_INDICATE_HOLD:
 		{
 			sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			switch_channel_set_flag(channel, CF_LEG_HOLDING);
 			sofia_glue_do_invite(session);
 			if (!zstr(msg->string_arg)) {
 				char message[256] = "";
@@ -1470,6 +1455,7 @@
 	case SWITCH_MESSAGE_INDICATE_UNHOLD:
 		{
 			sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 			sofia_glue_do_invite(session);
 		}
 		break;
@@ -1935,6 +1921,7 @@
 				stream->write_function(stream, "Freq    \t%d\n", gp->freq);
 				stream->write_function(stream, "Ping    \t%d\n", gp->ping);
 				stream->write_function(stream, "PingFreq\t%d\n", gp->ping_freq);
+				stream->write_function(stream, "PingState\t%d/%d/%d\n", gp->ping_min, gp->ping_count, gp->ping_max);
 				stream->write_function(stream, "State   \t%s\n", sofia_state_names[gp->state]);
 				stream->write_function(stream, "Status  \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
 				stream->write_function(stream, "CallsIN \t%d\n", gp->ib_calls);
@@ -1979,7 +1966,9 @@
 					}
 					stream->write_function(stream, "HOLD-MUSIC       \t%s\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
 					stream->write_function(stream, "OUTBOUND-PROXY   \t%s\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
-					stream->write_function(stream, "CODECS           \t%s\n", switch_str_nil(profile->codec_string));
+					stream->write_function(stream, "CODECS IN        \t%s\n", switch_str_nil(profile->inbound_codec_string));
+					stream->write_function(stream, "CODECS OUT       \t%s\n", switch_str_nil(profile->outbound_codec_string));
+
 					stream->write_function(stream, "TEL-EVENT        \t%d\n", profile->te);
 					if (profile->dtmf_type == DTMF_2833) {
 					stream->write_function(stream, "DTMF-MODE        \trfc2833\n");
@@ -2199,7 +2188,9 @@
 					stream->write_function(stream, "    <tls-bind-url>%s</tls-bind-url>\n", switch_str_nil(profile->tls_bindurl));
 					stream->write_function(stream, "    <hold-music>%s</hold-music>\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
 					stream->write_function(stream, "    <outbound-proxy>%s</outbound-proxy>\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
-					stream->write_function(stream, "    <codecs>%s</codecs>\n", switch_str_nil(profile->codec_string));
+					stream->write_function(stream, "    <inbound-codecs>%s</inbound-codecs>\n", switch_str_nil(profile->inbound_codec_string));
+					stream->write_function(stream, "    <outbound-codecs>%s</outbound-codecs>\n", switch_str_nil(profile->outbound_codec_string));
+
 					stream->write_function(stream, "    <tel-event>%d</tel-event>\n", profile->te);
 					stream->write_function(stream, "    <dtmf-mode>rfc2833</dtmf-mode>\n");
 					stream->write_function(stream, "    <dtmf-mode>info</dtmf-mode>\n");
@@ -3083,6 +3074,8 @@
 		}
 	}
 
+	switch_channel_set_variable(nchannel, "sip_profile_name", profile_name);
+
 	sofia_glue_get_user_host(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip);
 
 	if (dest_to) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/mod_sofia.h (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-11-29 05:19:09 UTC (rev 15705)
@@ -201,6 +201,7 @@
 	PFLAG_SIPCOMPACT,
 	PFLAG_SQL_IN_TRANS,
 	PFLAG_PASS_CALLEE_ID,
+	PFLAG_LOG_AUTH_FAIL,
 	/* No new flags below this line */
 	PFLAG_MAX
 } PFLAGS;
@@ -377,6 +378,9 @@
 	int pinging;
 	sofia_gateway_status_t status;
 	uint32_t ping_freq;
+	int ping_count;
+	int ping_max;
+	int ping_min;
 	uint8_t flags[REG_FLAG_MAX];
 	int32_t retry_seconds;
 	reg_state_t state;
@@ -455,7 +459,8 @@
 	switch_port_t sip_port;
 	switch_port_t tls_sip_port;
 	int tls_version;
-	char *codec_string;
+	char *inbound_codec_string;
+	char *outbound_codec_string;
 	int running;
 	int dtmf_duration;
 	uint8_t flags[TFLAG_MAX];
@@ -701,6 +706,8 @@
 
 void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt);
 
+const char *sofia_glue_get_codec_string(private_object_t *tech_pvt);
+
 void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame);
 
 switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -30,6 +30,7 @@
  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  * Norman Brandinger
  * Raymond Chandler <intralanman@gmail.com>
+ * Nathan Patrick <npatrick at corp.sonic.net>
  *
  *
  * sofia.c -- SOFIA SIP Endpoint (sofia code)
@@ -1450,6 +1451,7 @@
 			const char *sipip, *format;
 			switch_uuid_t uuid;
 			uint32_t ping_freq = 0, extension_in_contact = 0, distinct_to = 0;
+			int ping_max = 0, ping_min = 0;
 			char *register_str = "true", *scheme = "Digest",
 				*realm = NULL,
 				*username = NULL,
@@ -1479,8 +1481,10 @@
 			gateway->next = NULL;
 			gateway->ping = 0;
 			gateway->ping_freq = 0;
+			gateway->ping_max = 1;
+			gateway->ping_min = -1;
+			gateway->ping_count = 0;
 			
-			
 			if ((x_params = switch_xml_child(gateway_tag, "variables"))) {
 				param = switch_xml_child(x_params, "variable");
 			} else {
@@ -1551,6 +1555,10 @@
 					extension = val;
 				} else if (!strcmp(var, "ping")) {
 					ping_freq = atoi(val);
+				} else if (!strcmp(var, "ping-max")) {
+					ping_max = atoi(val);
+				} else if (!strcmp(var, "ping-min")) {
+					ping_min = atoi(val);
 				} else if (!strcmp(var, "proxy")) {
 					proxy = val;
 				} else if (!strcmp(var, "context")) {
@@ -1590,6 +1598,8 @@
 			if (ping_freq) {
 				if (ping_freq >= 5) {
 					gateway->ping_freq = ping_freq;
+					gateway->ping_max = ping_max;
+					gateway->ping_min = ping_min;
 					gateway->ping = switch_epoch_time_now(NULL) + ping_freq;
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n");
@@ -1835,7 +1845,7 @@
 			profile->ib_calls = 0;
 			profile->ob_calls = 0;
 			profile->ib_failed_calls = 0;
-			profile->ob_failed_calls = 0;
+			profile->ob_failed_calls = 0;		
 
 			if (xprofiledomain) {
 				profile->domain_name = switch_core_strdup(profile->pool, xprofiledomain);
@@ -1877,6 +1887,12 @@
 						profile->user_agent = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "auto-restart")) {
 						profile->auto_restart = switch_true(val);
+					} else if (!strcasecmp(var, "log-auth-failures")) {
+						if (switch_true(val)) { 
+							sofia_set_pflag(profile, PFLAG_LOG_AUTH_FAIL);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
+						}
 					} else if (!strcasecmp(var, "dtmf-type")) {
 						if (!strcasecmp(val, "rfc2833")) {
 							profile->dtmf_type = DTMF_2833;
@@ -2163,7 +2179,12 @@
 					} else if (!strcasecmp(var, "max-calls")) {
 						profile->max_calls = atoi(val);
 					} else if (!strcasecmp(var, "codec-prefs")) {
-						profile->codec_string = switch_core_strdup(profile->pool, val);
+						profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
+						profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "inbound-codec-prefs")) {
+						profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "outbound-codec-prefs")) {
+						profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "challenge-realm")) {
 						profile->challenge_realm = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "dtmf-duration")) {
@@ -2432,6 +2453,12 @@
 						profile->user_agent = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "auto-restart")) {
 						profile->auto_restart = switch_true(val);
+					} else if (!strcasecmp(var, "log-auth-failures")) {
+						if (switch_true(val)) { 
+							sofia_set_pflag(profile, PFLAG_LOG_AUTH_FAIL);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
+						}
 					} else if (!strcasecmp(var, "dtmf-type")) {
 						if (!strcasecmp(val, "rfc2833")) {
 							profile->dtmf_type = DTMF_2833;
@@ -2861,7 +2888,12 @@
 					} else if (!strcasecmp(var, "max-calls")) {
 						profile->max_calls = atoi(val);
 					} else if (!strcasecmp(var, "codec-prefs")) {
-						profile->codec_string = switch_core_strdup(profile->pool, val);
+						profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
+						profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "inbound-codec-prefs")) {
+						profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "outbound-codec-prefs")) {
+						profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "challenge-realm")) {
 						profile->challenge_realm = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "dtmf-duration")) {
@@ -3176,6 +3208,7 @@
 									   tagi_t tags[])
 {
 	sofia_gateway_t *gateway = NULL;
+	static const char *status_names[] = { "DOWN", "UP", NULL };
 
 	if (sofia_private && !zstr(sofia_private->gateway_name)) {
 		gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
@@ -3187,15 +3220,35 @@
 			if (gateway->state == REG_STATE_FAILED) {
 				gateway->state = REG_STATE_UNREGED;
 			}
-			gateway->status = SOFIA_GATEWAY_UP;
+
+			if (gateway->ping_count < gateway->ping_max) {
+				gateway->ping_count++;
+
+				if (gateway->ping_count >= 0) gateway->status = SOFIA_GATEWAY_UP;
+
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+					"Ping succeeded %s with code %d - count %d/%d/%d, state %s\n",
+					gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max,
+					status_names[gateway->status]);
+			}
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Ping failed %s\n", gateway->name);
-			gateway->status = SOFIA_GATEWAY_DOWN;
 			if (gateway->state == REG_STATE_REGED) {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unregister %s\n", gateway->name);
 				gateway->state = REG_STATE_FAILED;
 			}
+
+			if (gateway->ping_count > gateway->ping_min) {
+				gateway->ping_count--;
+
+				if (gateway->ping_count <= 0) gateway->status = SOFIA_GATEWAY_DOWN;
+			}
+
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+				"Ping failed %s with code %d - count %d/%d/%d, state %s\n",
+				gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max,
+				status_names[gateway->status]);
 		}
+
 		gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
 		sofia_reg_release_gateway(gateway);
 		gateway->pinging = 0;
@@ -3657,7 +3710,7 @@
 
 				if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
 					if ((sdp = sdp_session(parser))) {
-						sofia_glue_set_r_sdp_codec_string(session, (tech_pvt->profile?tech_pvt->profile->codec_string:NULL), sdp);
+						sofia_glue_set_r_sdp_codec_string(session, sofia_glue_get_codec_string(tech_pvt), sdp);
 					}
 					sdp_parser_free(parser);
 				}
@@ -3821,6 +3874,7 @@
 										switch_ivr_uuid_bridge(br_a, br_b);
 										switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
 										sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+										switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 										sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 										switch_channel_hangup(channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
 									} else {
@@ -3964,10 +4018,12 @@
 						if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 							if (!switch_stristr("sendonly", r_sdp)) {
 								sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+								switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 								switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
 							}
 						} else if (switch_stristr("sendonly", r_sdp)) {
 							sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+							switch_channel_set_flag(channel, CF_LEG_HOLDING);
 							switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
 						}
 					
@@ -4277,11 +4333,11 @@
 {
 	nightmare_xfer_helper_t *nhelper = (nightmare_xfer_helper_t *) obj;
 	switch_memory_pool_t *pool;
-	switch_status_t status;
+	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_core_session_t *session, *a_session;
 	
 	if ((a_session = switch_core_session_locate(nhelper->bridge_to_uuid))) {
-		switch_core_session_t *tsession;
+		switch_core_session_t *tsession = NULL;
 		switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
 		uint32_t timeout = 60;
 		char *tuuid_str;
@@ -4290,34 +4346,32 @@
 			private_object_t *tech_pvt = switch_core_session_get_private(session);
 			switch_channel_t *channel_a = switch_core_session_get_channel(session);
 
-			status = switch_ivr_originate(NULL, &tsession, &cause, nhelper->exten, timeout, NULL, NULL, NULL,
-                                          switch_channel_get_caller_profile(channel_a), nhelper->vars, SOF_NONE, NULL);
-
-			if ((switch_channel_up(channel_a))) {
-				if (status != SWITCH_STATUS_SUCCESS || cause != SWITCH_CAUSE_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! [%s]\n", nhelper->exten);
-					nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("messsage/sipfrag"),
-							   NUTAG_SUBSTATE(nua_substate_terminated),
-							   SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
-					status = SWITCH_STATUS_FALSE;
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Don't be sad.... I tried to warn you.\n");
-				} else {
+			if ((status = switch_ivr_originate(NULL, &tsession, &cause, nhelper->exten, timeout, NULL, NULL, NULL,
+											   switch_channel_get_caller_profile(channel_a), 
+											   nhelper->vars, SOF_NONE, NULL)) == SWITCH_STATUS_SUCCESS) {
+				if (switch_channel_up(channel_a)) {
 					tuuid_str = switch_core_session_get_uuid(tsession);
 					switch_ivr_uuid_bridge(nhelper->bridge_to_uuid, tuuid_str);
 					switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
 					sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
-					nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-							   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
-					switch_core_session_rwunlock(tsession);
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Congratulations! You have *no* idea how lucky you are!\n");
+				} else {
+					switch_channel_hangup(switch_core_session_get_channel(tsession), SWITCH_CAUSE_ORIGINATOR_CANCEL);
+					status = SWITCH_STATUS_FALSE;
 				}
+				switch_core_session_rwunlock(tsession);
+			}
+
+			if (status == SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "The nightmare is over.....\n");
 			} else {
-				nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("messsage/sipfrag"),
-						   NUTAG_SUBSTATE(nua_substate_terminated),
-						   SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
-				status = SWITCH_STATUS_FALSE;
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Wow, This could not have turned out any worse...=/ Sorry...\n");
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "1 .. 2 .. Freddie's commin' for you...\n");
 			}
+
+			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("messsage/sipfrag"),
+					   NUTAG_SUBSTATE(nua_substate_terminated),
+					   SIPTAG_PAYLOAD_STR(status == SWITCH_STATUS_SUCCESS ? "SIP/2.0 200 OK": 
+										  "SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
+
 			switch_core_session_rwunlock(session);
 		}
 
@@ -4487,6 +4541,7 @@
 							
 							
 							sofia_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
+							switch_channel_clear_flag(channel_b, CF_LEG_HOLDING);
 							sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 
 							switch_channel_set_variable(channel_b, SWITCH_HOLDING_UUID_VARIABLE, br_a);
@@ -4555,6 +4610,7 @@
 									   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
 
 							sofia_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
+							switch_channel_clear_flag(channel_b, CF_LEG_HOLDING);
 							sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 							switch_channel_set_variable(channel_b, "park_timeout", "2");
 							switch_channel_set_state(channel_b, CS_PARK);
@@ -4578,7 +4634,9 @@
 									t_session = switch_core_session_locate(br_b);
 									hup_channel = channel_a;
 									sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+									switch_channel_clear_flag(tech_pvt->channel, CF_LEG_HOLDING);
 									sofia_clear_flag_locked(h_tech_pvt, TFLAG_SIP_HOLD);
+									switch_channel_clear_flag(h_tech_pvt->channel, CF_LEG_HOLDING);
 									switch_channel_hangup(channel_b, SWITCH_CAUSE_ATTENDED_TRANSFER);
 								}
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia_glue.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia_glue.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia_glue.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -409,6 +409,23 @@
 	sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
 }
 
+const char *sofia_glue_get_codec_string(private_object_t *tech_pvt)
+{
+	const char *codec_string = NULL, *preferred = NULL, *fallback = NULL;
+	
+	if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+		preferred = tech_pvt->profile->outbound_codec_string;
+		fallback = tech_pvt->profile->inbound_codec_string;
+	} else {
+		preferred = tech_pvt->profile->inbound_codec_string;
+		fallback = tech_pvt->profile->outbound_codec_string;
+	}
+
+	codec_string = !zstr(preferred) ? preferred : fallback;
+	
+	return codec_string;
+}
+
 void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt)
 {
 	const char *abs, *codec_string = NULL;
@@ -426,25 +443,29 @@
 
 	if ((abs = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) {
 		codec_string = abs;
-	} else {
-		if (!(codec_string = switch_channel_get_variable(tech_pvt->channel, "codec_string"))) {
-			if (tech_pvt->profile->codec_string) {
-				codec_string = tech_pvt->profile->codec_string;
-			}
+		goto ready;
+	}
+
+	if (!(codec_string = switch_channel_get_variable(tech_pvt->channel, "codec_string"))) {
+		codec_string = sofia_glue_get_codec_string(tech_pvt);
+		if (codec_string && *codec_string == '=') {
+			codec_string++;
+			goto ready;
 		}
+	}
 
-		if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
-			if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
+	if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
+		if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
+			codec_string = ocodec;
+		} else {
+			if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
 				codec_string = ocodec;
-			} else {
-				if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
-					codec_string = ocodec;
-				}
 			}
 		}
 	}
+	
+ ready:
 
-
 	if (codec_string) {
 		char *tmp_codec_string;
 		if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) {
@@ -1149,7 +1170,8 @@
 
 	len = strlen(tech_pvt->local_sdp_str) * 2;
 	
-	if (switch_stristr("sendonly", tech_pvt->local_sdp_str) || switch_stristr("0.0.0.0", tech_pvt->local_sdp_str)) {
+	if (switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && 
+		(switch_stristr("sendonly", tech_pvt->local_sdp_str) || switch_stristr("0.0.0.0", tech_pvt->local_sdp_str))) {
 	    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n");
 	    return;
 	}
@@ -2343,6 +2365,10 @@
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params changed for %s from %s:%d to %s:%d\n", 
 							  switch_channel_get_name(tech_pvt->channel),
 							  remote_host, remote_port, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
+
+			switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
+			switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
+			switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
 		}
 	}
 
@@ -2539,6 +2565,11 @@
 			switch_channel_set_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE, "true");
 		}
 
+
+		switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
+		switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
+		switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
+
 	  video:
 
 		sofia_glue_check_video_codecs(tech_pvt);
@@ -2885,6 +2916,7 @@
 			const char *stream;
 
 			sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			switch_channel_set_flag(tech_pvt->channel, CF_LEG_HOLDING);
 			switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
 
 			if (tech_pvt->max_missed_hold_packets) {
@@ -2909,6 +2941,7 @@
 	} else {
 		if (sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
 			sofia_set_flag(tech_pvt, TFLAG_SIP_HOLD);
+			switch_channel_set_flag(tech_pvt->channel, CF_LEG_HOLDING);
 		}
 
 		sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
@@ -2939,6 +2972,7 @@
 			}
 
 			sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+			switch_channel_clear_flag(tech_pvt->channel, CF_LEG_HOLDING);
 			switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
 		}
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia_reg.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia_reg.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/endpoints/mod_sofia/sofia_reg.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -449,7 +449,6 @@
 	}
 
 	sofia_glue_send_notify(profile, user, host, event, contenttype, body, contact, network_ip);
-
 }
 
 int sofia_sla_dialog_del_callback(void *pArg, int argc, char **argv, char **columnNames)
@@ -928,7 +927,6 @@
 					if (*received_data && sofia_test_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
 						switch_snprintf(received_data, sizeof(received_data), ";received=%s:%d", url_ip, network_port);
 					}
-
 	
 					if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
 						!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
@@ -972,6 +970,17 @@
 			}
 			if (auth_res == AUTH_FORBIDDEN) {
 				nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
+				
+				/* Log line added to support Fail2Ban */
+				if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
+					if (regtype == REG_REGISTER) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (REGISTER) on sofia profile '%s' "
+										  "for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip);
+					} else if (regtype == REG_INVITE) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (INVITE) on sofia profile '%s' "
+										  "for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip);
+					}									  
+				}
 			} else {
 				nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
 			}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -2297,6 +2297,7 @@
 	switch_socket_t *inbound_socket = NULL;
 	listener_t *listener;
 	uint32_t x = 0;
+	uint32_t errs = 0;
 
 	if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
@@ -2342,15 +2343,23 @@
 			goto fail;
 		}
 
+		
 		if ((rv = switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool))) {
 			if (prefs.done) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
+				goto end;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error\n");
+				/* I wish we could use strerror_r here but its not defined everywhere =/ */
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error [%s]\n", strerror(errno));
+				if (++errs > 100) {
+					goto end;
+				}
 			}
-			break;
+		} else {
+			errs = 0;
 		}
 
+		
 		if (!(listener = switch_core_alloc(listener_pool, sizeof(*listener)))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n");
 			break;
@@ -2376,6 +2385,8 @@
 
 	}
 
+ end:
+
 	close_socket(&listen_list.sock);
 	
 	if (prefs.nat_map && switch_core_get_variable("nat_type")) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/languages/mod_spidermonkey/sm.mak (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/languages/mod_spidermonkey/sm.mak	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/languages/mod_spidermonkey/sm.mak	2009-11-29 05:19:09 UTC (rev 15705)
@@ -3,7 +3,7 @@
 JSLA=$(JS_DIR)/libjs.la
 
 LOCAL_CFLAGS+=-I$(JS_DIR)/src -I$(JS_DIR)/nsprpub/dist/include/nspr  -DXP_UNIX -I../mod_spidermonkey  -DJS_THREADSAFE -DJS_HAS_FILE_OBJECT=1 -DJS_HAS_XML_SUPPORT=1
-LOCAL_LDFLAGS_POST=$(JS_DIR)/nsprpub/pr/src/libnspr4.*
+LOCAL_LDFLAGS_POST=-L$(JS_DIR)/nsprpub/dist/lib -lnspr4 $(JS_DIR)/nsprpub/pr/src/libnspr4.*
 LOCAL_LIBADD+=$(JSLA)
 
 include $(switch_srcdir)/build/modmake.rules

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -168,7 +168,11 @@
 }
 
 
-static JSBool db_next(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+/* Evaluate a prepared statement
+  stepSuccessCode expected success code from switch_core_db_step() 
+  return true if step return expected success code, false otherwise
+*/
+static JSBool db_step_ex(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval, int stepSuccessCode)
 {
 	struct db_obj *dbo = JS_GetPrivate(cx, obj);
 	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -181,14 +185,17 @@
 		int running = 1;
 		while (running < 5000) {
 			int result = switch_core_db_step(dbo->stmt);
-			if (result == SWITCH_CORE_DB_ROW) {
+			if (result == stepSuccessCode) {
 				*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
 				break;
 			} else if (result == SWITCH_CORE_DB_BUSY) {
 				running++;
+				switch_cond_next(); /* wait a bit before retrying */
 				continue;
+			} 
+			if (switch_core_db_finalize(dbo->stmt) != SWITCH_CORE_DB_OK) {	
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", switch_core_db_errmsg(dbo->db));
 			}
-			switch_core_db_finalize(dbo->stmt);
 			dbo->stmt = NULL;
 			break;
 		}
@@ -197,6 +204,25 @@
 	return JS_TRUE;
 }
 
+/* Evaluate a prepared statement, to be used with statements that return data 
+  return true while data is available, false when done or error
+*/
+static JSBool db_next(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+    /* return true until no more rows available */
+	return db_step_ex(cx, obj, argc, argv, rval, SWITCH_CORE_DB_ROW);
+}
+
+/* Evaluate a prepared statement, to be used with statements that return no data 
+  return true if statement has finished executing successfully, false otherwise 
+*/
+static JSBool db_step(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+    /* return true when the statement has finished executing successfully */
+	return db_step_ex(cx, obj, argc, argv, rval, SWITCH_CORE_DB_DONE);
+}
+
+
 static JSBool db_fetch(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct db_obj *dbo = JS_GetPrivate(cx, obj);
@@ -258,6 +284,98 @@
 	return JS_TRUE;
 }
 
+static JSBool db_bind_text(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+	JSBool status;
+	uint32 param_index = -1;
+    char *param_value = NULL;
+
+	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+
+	if (!dbo->db) {
+		return JS_FALSE;
+	}
+
+    /* db_prepare() must be called first */
+	if (!dbo->stmt) {
+		return JS_FALSE;
+	}
+
+	/* argv[0] = parameter index
+       argv[1] = parameter value
+     */
+	if (argc < 2) {
+		return JS_FALSE;
+	}
+
+	
+
+	/* convert args */
+	status = JS_ValueToECMAUint32(cx, argv[0], &param_index);
+	switch_assert(status == JS_TRUE);
+    param_value = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+	if ((param_index < 1) || (NULL == param_value)) {
+		return  JS_FALSE;
+	}
+
+	/* bind param */
+	if (switch_core_db_bind_text(dbo->stmt, param_index, param_value, -1, SWITCH_CORE_DB_STATIC)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", switch_core_db_errmsg(dbo->db));
+		return JS_FALSE;
+	} else {
+		*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+	}
+
+	return JS_TRUE;
+}
+
+static JSBool db_bind_int(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+	JSBool status;
+	uint32 param_index = -1;
+	uint32 param_value = -1;
+
+	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+
+	if (!dbo->db) {
+		return JS_FALSE;
+	}
+
+    /* db_prepare() must be called first */
+	if (!dbo->stmt) {
+		return JS_FALSE;
+	}
+
+	/* argv[0] = parameter index
+       argv[1] = parameter value
+     */
+	if (argc < 2) {
+		return JS_FALSE;
+	}
+
+	/* convert args */
+	status = JS_ValueToECMAUint32(cx, argv[0], &param_index);
+	switch_assert(status == JS_TRUE);
+	status = JS_ValueToECMAUint32(cx, argv[1], &param_value);
+	switch_assert(status == JS_TRUE);
+
+	if (param_index < 1)  {
+		return  JS_FALSE;
+	}
+
+	/* bind param */
+	if (switch_core_db_bind_int(dbo->stmt, param_index, param_value)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", switch_core_db_errmsg(dbo->db));
+		return JS_FALSE;
+	} else {
+		*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+	}
+
+	return JS_TRUE;
+}
+
 enum db_tinyid {
 	DB_NAME
 };
@@ -266,8 +384,11 @@
 	{"exec", db_exec, 1},
 	{"close", db_close, 0},
 	{"next", db_next, 0},
+	{"step", db_step, 0},
 	{"fetch", db_fetch, 1},
 	{"prepare", db_prepare, 0},
+	{"bindText", db_bind_text, 2},
+	{"bindInt", db_bind_int, 2},
 	{0}
 };
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_caller.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_caller.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_caller.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -394,6 +394,25 @@
 	return caller_extension;
 }
 
+
+SWITCH_DECLARE(void) switch_caller_extension_add_application_printf(switch_core_session_t *session,
+															 switch_caller_extension_t *caller_extension, const char *application_name,
+															 const char *fmt, ...)
+{
+	va_list ap;
+	char *data = NULL;
+	
+	va_start(ap, fmt);
+	switch_vasprintf(&data, fmt, ap);
+	va_end(ap);
+	
+	if (data) {
+		switch_caller_extension_add_application(session, caller_extension, application_name, data);	
+		free(data);
+	}
+}
+
+
 SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session_t *session,
 															 switch_caller_extension_t *caller_extension, const char *application_name,
 															 const char *application_data)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_core_memory.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_core_memory.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_core_memory.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -569,12 +569,8 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping memory pool queue.\n");
 
-	memory_manager.pool_thread_running = -1;
+	memory_manager.pool_thread_running = 0;
 	switch_thread_join(&st, pool_thread_p);
-	
-	while (memory_manager.pool_thread_running) {
-		switch_cond_next();
-	}
 #endif
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_core_sqldb.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_core_sqldb.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_core_sqldb.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -171,6 +171,8 @@
 		if ((dbh = (switch_cache_db_handle_t *) val)) {
 			if (switch_mutex_trylock(dbh->mutex) == SWITCH_STATUS_SUCCESS) {
 				if (strstr(dbh->name, thread_str)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, 
+									  "Detach cached DB handle %s [%s]\n", thread_str, switch_cache_db_type_name(dbh->type));
 					switch_clear_flag(dbh, CDF_INUSE);
 				} 
 				switch_mutex_unlock(dbh->mutex);
@@ -188,18 +190,28 @@
 {
 	switch_thread_id_t self = switch_thread_self();
 	char thread_str[CACHE_DB_LEN] = "";
+	char db_str[CACHE_DB_LEN] = "";
+	char db_callsite_str[CACHE_DB_LEN] = "";
 	switch_cache_db_handle_t *new_dbh = NULL;
+	switch_ssize_t hlen = -1;
+
 	const char *db_name = NULL;
+	const char *db_user = NULL;
+	const char *db_pass = NULL;
 
 	switch (type) {
 	case SCDB_TYPE_ODBC:
 		{
 			db_name = connection_options->odbc_options.dsn;
+			db_user = connection_options->odbc_options.user;
+			db_pass = connection_options->odbc_options.pass;
 		}
 		break;
 	case SCDB_TYPE_CORE_DB:
 		{
 			db_name = connection_options->core_db_options.db_path;
+			db_user = "";
+			db_pass = "";
 		}
 		break;
 	}
@@ -208,28 +220,36 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-     
-	snprintf(thread_str, sizeof(thread_str) - 1, "%s_%lu", db_name, (unsigned long)(intptr_t)self);
+	snprintf(db_str, sizeof(db_str) - 1, "db=\"%s\";user=\"%s\";pass=\"%s\"", db_name, db_user, db_pass);
+	snprintf(thread_str, sizeof(thread_str) - 1, "%s;thread=\"%lu\"", db_str, (unsigned long)(intptr_t)self);
+	snprintf(db_callsite_str, sizeof(db_callsite_str) - 1, "%s:%d", file, line);
 	
 	switch_mutex_lock(dbh_mutex);
 	if ((new_dbh = switch_core_hash_find(dbh_hash, thread_str))) {
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG1, 
+		switch_set_string(new_dbh->last_user, db_callsite_str);
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG10, 
 						  "Reuse Cached DB handle %s [%s]\n", thread_str, switch_cache_db_type_name(new_dbh->type));
 	} else {
 		switch_hash_index_t *hi;
 		const void *var;
 		void *val;
 		char *key;
+		unsigned long hash = 0;
+		
+		hash = switch_ci_hashfunc_default(db_str, &hlen);
 
 		for (hi = switch_hash_first(NULL, dbh_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, &var, NULL, &val);
 			key = (char *) var;
 			
 			if ((new_dbh = (switch_cache_db_handle_t *) val)) {
-				if (!switch_test_flag(new_dbh, CDF_INUSE) && switch_mutex_trylock(new_dbh->mutex) == SWITCH_STATUS_SUCCESS) {
+				if (hash == new_dbh->hash && !strncasecmp(new_dbh->name, db_str, strlen(db_str)) && 
+					!switch_test_flag(new_dbh, CDF_INUSE) && switch_mutex_trylock(new_dbh->mutex) == SWITCH_STATUS_SUCCESS) {
 					switch_set_flag(new_dbh, CDF_INUSE);
 					switch_set_string(new_dbh->name, thread_str);
-					switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG1, 
+					new_dbh->hash = switch_ci_hashfunc_default(db_str, &hlen);
+					switch_set_string(new_dbh->last_user, db_callsite_str);
+					switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG10, 
 									  "Reuse Unused Cached DB handle %s [%s]\n", thread_str, switch_cache_db_type_name(new_dbh->type));
 					break;
 				}
@@ -278,8 +298,8 @@
 			goto end;
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG1, 
-						  "Create Cached DB handle %s [%s]\n", thread_str, db ? "sqlite" : "ODBC");
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG10, 
+						  "Create Cached DB handle %s [%s]\n", thread_str, switch_cache_db_type_name(type));
 
 		switch_core_new_memory_pool(&pool);
 		new_dbh = switch_core_alloc(pool, sizeof(*new_dbh));
@@ -287,9 +307,12 @@
 		new_dbh->type = type;
 		switch_set_string(new_dbh->name, thread_str);
 		switch_set_flag(new_dbh, CDF_INUSE);
-		
+		new_dbh->hash = switch_ci_hashfunc_default(db_str, &hlen);
+
+
 		if (db) new_dbh->native_handle.core_db_dbh = db; else new_dbh->native_handle.odbc_dbh = odbc_dbh;
 		switch_mutex_init(&new_dbh->mutex, SWITCH_MUTEX_UNNESTED, new_dbh->pool);
+		switch_set_string(new_dbh->creator, db_callsite_str);
 		switch_mutex_lock(new_dbh->mutex);
 
 		switch_core_hash_insert(dbh_hash, new_dbh->name, new_dbh);
@@ -354,7 +377,7 @@
 	char *p, *s, *e;
 	int chunk_count;
 	switch_size_t len;
-	
+
 	switch_assert(chunk_size);
 
 	if (err) *err = NULL;
@@ -379,23 +402,25 @@
 			p = e;
 		}
 		
-		while (p > s && *p != ';') {
+		while (p > s) {
+			if (*p == '\n' && *(p-1) == ';') {
+				*p = '\0';
+				*(p-1) = '\0';
+				break;
+			}
+			
 			p--;
 		}
 
-		if (p) {
-			*p = '\0';
-			while(p < e && (*p == '\n' || *p == ' ')) {
-				p++;
-			}
-		}
+		if (p <= s) break;
 		
+		
 		status = switch_cache_db_execute_sql_real(dbh, s, err);
 		if (status != SWITCH_STATUS_SUCCESS || (err && *err)) {
 			break;
 		}
 
-		s = p + 1;
+		s = p;
 	
 	}
 
@@ -410,14 +435,9 @@
 
 
 	switch (dbh->type) {
-	case SCDB_TYPE_CORE_DB:
-		{
-			status = switch_cache_db_execute_sql_real(dbh, sql, err);
-		}
-		break;
 	default:
 		{
-			status = switch_cache_db_execute_sql_chunked(dbh, (char *)sql, 32000, err);
+			status = switch_cache_db_execute_sql_chunked(dbh, (char *)sql, 32768, err);
 		}
 		break;
 	}
@@ -629,7 +649,9 @@
 	case SCDB_TYPE_ODBC:
 		{
 			if (switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
-				switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, drop_sql, NULL);
+				if (drop_sql) {
+					switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, drop_sql, NULL);
+				}
 				switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, reactive_sql, NULL);
 			}
 		}
@@ -1143,7 +1165,7 @@
 			runtime.odbc_dsn = NULL;
 			runtime.odbc_user = NULL;
 			runtime.odbc_pass = NULL;
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Falling back to sqlite.\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Falling back to core_db.\n");
 			goto top;
 		}
 
@@ -1288,6 +1310,61 @@
 
 }
 
+SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream)
+{
+	/* return some status info suitable for the cli */
+	switch_hash_index_t *hi;
+	switch_cache_db_handle_t *dbh = NULL;
+	void *val;
+	const void *var;
+	char *key;
+	switch_bool_t locked = SWITCH_FALSE;
+	time_t now = switch_epoch_time_now(NULL);
+	char cleankey_str[CACHE_DB_LEN];
+	char *pos1 = NULL;
+	char *pos2 = NULL;
+	
+	switch_mutex_lock(dbh_mutex);
+	
+	for (hi = switch_hash_first(NULL, dbh_hash); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, &var, NULL, &val);
+		key = (char *) var;
+
+		if ((dbh = (switch_cache_db_handle_t *) val)) {
+			char *needle = "pass=\"";
+			time_t diff = 0;
+
+			diff = now - dbh->last_used;
+			
+			if (switch_mutex_trylock(dbh->mutex) == SWITCH_STATUS_SUCCESS) {
+				switch_mutex_unlock(dbh->mutex);
+				locked = SWITCH_FALSE;
+			} else {
+				locked = SWITCH_TRUE;
+			}
+
+			/* sanitize password */
+			memset(cleankey_str, 0, sizeof(cleankey_str));
+			pos1 = strstr(key, needle) + strlen(needle);
+			pos2 = strstr(pos1, "\"");
+			strncpy(cleankey_str, key, pos1-key);
+			strcpy(&cleankey_str[pos1-key], pos2);
+			
+			
+			stream->write_function(stream, "%s\n\tType: %s\n\tLast used: %d\n\tFlags: %s, %s\n"
+											"\tCreator: %s\n\tLast User: %s\n",
+				cleankey_str,
+				switch_cache_db_type_name(dbh->type),
+				diff,
+				locked ? "Locked" : "Unlocked",
+				switch_test_flag(dbh, CDF_INUSE) ? "Attached" : "Detached",
+				dbh->creator,
+				dbh->last_user);
+		}
+	}
+	switch_mutex_unlock(dbh_mutex);
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_ivr_async.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_ivr_async.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_ivr_async.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -628,7 +628,7 @@
 		const char *macro_name = "eavesdrop_announce";
 		const char *id_name = NULL;
 		switch_codec_implementation_t tread_impl = {0}, read_impl = {0};
-
+		switch_core_session_message_t msg = { 0 };
 		
 		if (!switch_channel_media_ready(channel)) {
 			goto end;
@@ -734,6 +734,14 @@
 			goto end;
 		}
 
+
+		msg.from = __FILE__;
+		
+		/* Tell the channel we are going to be in a bridge */
+		msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
+		switch_core_session_receive_message(session, &msg);
+		
+
 		while (switch_channel_ready(tchannel) && switch_channel_ready(channel)) {
 			uint32_t len = sizeof(buf);
 			switch_event_t *event = NULL;
@@ -743,7 +751,7 @@
 			status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 
 			if (!SWITCH_READ_ACCEPTABLE(status)) {
-				goto end;
+				goto end_loop;
 			}
 
 			if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
@@ -784,7 +792,7 @@
 						switch_clear_flag(ep, ED_MUX_WRITE);
 						break;
 					case '*':
-						goto end;
+						goto end_loop;
 					default:
 						z = 0;
 						break;
@@ -836,7 +844,16 @@
 
 		}
 
+	end_loop:
+
+		/* Tell the channel we are no longer going to be in a bridge */
+		msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
+		switch_core_session_receive_message(session, &msg);
+
+
+
 	  end:
+
 		if ( codec_initialized )
 			switch_core_codec_destroy(&codec);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_ivr_bridge.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_ivr_bridge.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_ivr_bridge.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1083,7 +1083,26 @@
 			switch_channel_set_state(peer_channel, CS_EXCHANGE_MEDIA);
 			audio_bridge_thread(NULL, (void *) a_leg);
 			
+			if (switch_channel_test_flag(caller_channel, CF_LEG_HOLDING)) {
+				const char *ext = switch_channel_get_variable(caller_channel, "hold_hangup_xfer_exten");
+				if (!zstr(ext)) {
+					switch_channel_set_variable(peer_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, ext);
+				}
+				switch_channel_clear_flag(caller_channel, CF_LEG_HOLDING);
+			}
+
+			if (switch_channel_test_flag(peer_channel, CF_LEG_HOLDING)) {
+				const char *ext = switch_channel_get_variable(peer_channel, "hold_hangup_xfer_exten");
+				if (!zstr(ext)) {
+					switch_channel_set_variable(caller_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, ext);
+				}
+				switch_channel_clear_flag(peer_channel, CF_LEG_HOLDING);
+			}
+
 			switch_channel_clear_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR);
+			
+			switch_channel_stop_broadcast(peer_channel);
+			
 
 			while (switch_channel_get_state(peer_channel) == CS_EXCHANGE_MEDIA) {
 				switch_cond_next();

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_rtp.c (15704 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_rtp.c	2009-11-29 04:58:51 UTC (rev 15704)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/src/switch_rtp.c	2009-11-29 05:19:09 UTC (rev 15705)
@@ -1778,6 +1778,8 @@
 
 static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
 {
+	switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+	switch_channel_t *channel = NULL;
 	switch_size_t bytes = 0;
 	switch_status_t status = SWITCH_STATUS_SUCCESS, poll_status = SWITCH_STATUS_SUCCESS;
 	int check = 0;
@@ -1788,6 +1790,10 @@
 	int fdr = 0;
 	int hot_socket = 0;
 
+	if (session) {
+		channel = switch_core_session_get_channel(session);
+	}
+
 	if (!switch_rtp_ready(rtp_session)) {
 		return -1;
 	}
@@ -1961,13 +1967,24 @@
 					const char *tx_host;
 					const char *old_host;
 					char bufa[30], bufb[30];
-					
+					char adj_port[5];
+
 					tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
 					old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);			
 	
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
 									  "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
 									  switch_sockaddr_get_port(rtp_session->from_addr));
+
+					if (channel) {
+						switch_channel_set_variable(channel, "remote_media_ip_reported", switch_channel_get_variable(channel, "remote_media_ip"));
+						switch_channel_set_variable(channel, "remote_media_ip", tx_host);
+						switch_snprintf (adj_port, sizeof(adj_port), "%u", switch_sockaddr_get_port(rtp_session->from_addr));
+						switch_channel_set_variable(channel, "remote_media_port_reported", switch_channel_get_variable(channel, "remote_media_port"));
+						switch_channel_set_variable(channel, "remote_media_port", adj_port);
+						switch_channel_set_variable(channel, "rtp_auto_adjust", "true");
+					}
+
 					switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), SWITCH_FALSE, &err);
 					switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
 				}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/FreePBX.url

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/FreePBX.url (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/FreePBX.url) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/FreePBX.url	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/FreePBX.url	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,5 @@
+[InternetShortcut]
+URL=http://127.0.0.1/freepbx-v3/
+IDList=
+[{000214A0-0000-0000-C000-000000000046}]
+Prop3=19,2

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/FusionPBX.url

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/FusionPBX.url (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/FusionPBX.url) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/FusionPBX.url	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/FusionPBX.url	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,6 @@
+[InternetShortcut]
+URL=http://127.0.0.1/fusionpbx
+IDList=
+HotKey=0
+[{000214A0-0000-0000-C000-000000000046}]
+Prop3=19,2

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_freepbx.bat

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_freepbx.bat (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/create_freepbx.bat) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_freepbx.bat	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_freepbx.bat	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,4 @@
+cd %1 
+ping 127.0.0.1 -n 5 -w 1000 > nul
+NET START wampmysqld
+wamp\bin\mysql\mysql5.1.36\bin\mysql --user=root <create_freepbx.sql
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_freepbx.sql

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_freepbx.sql (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/create_freepbx.sql) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_freepbx.sql	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_freepbx.sql	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,2 @@
+CREATE USER 'freepbx'@'localhost' IDENTIFIED BY 'freepbx';
+GRANT ALL ON *.* TO 'freepbx'@'localhost';

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_fusionpbx.bat

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_fusionpbx.bat (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/create_fusionpbx.bat) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_fusionpbx.bat	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_fusionpbx.bat	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,4 @@
+cd %1 
+ping 127.0.0.1 -n 5 -w 1000 > nul
+NET START wampmysqld
+wamp\bin\mysql\mysql5.1.36\bin\mysql --user=root <create_fusionpbx.sql
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_fusionpbx.sql

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_fusionpbx.sql (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/create_fusionpbx.sql) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_fusionpbx.sql	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/create_fusionpbx.sql	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,3 @@
+CREATE USER 'fusionpbx'@'localhost' IDENTIFIED BY 'fusionpbx';
+GRANT ALL ON *.* TO 'fusionpbx'@'localhost';
+create DATABASE fusionpbx

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/expsound.bat

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/expsound.bat (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/expsound.bat) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/expsound.bat	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/expsound.bat	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,5 @@
+echo off
+rem example call: expsound {tmp} {app} freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz
+
+IF EXIST %1\%3 %1\7za x -r -y -o%1 %1\%3
+IF EXIST %1\%~n3 %1\7za x -r -y -o%2\sounds %1\%~n3

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freepbx.ico

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freepbx.ico (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/freepbx.ico)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch.ico

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch.ico (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/freeswitch.ico)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch_1.0.4.iss

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch_1.0.4.iss (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/freeswitch_1.0.4.iss) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch_1.0.4.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch_1.0.4.iss	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,819 @@
+; Script generated by the Inno Setup Script Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+;AppId={{088C2C50-0D5F-4276-8771-FF54CAA14E70}
+AppName=FreeSWITCH
+AppVerName=FreeSWITCH 1.0.4
+AppPublisher=FreeSWITCH
+AppPublisherURL=http://www.freeswitch.org
+AppSupportURL=http://www.freeswitch.org
+AppUpdatesURL=http://www.freeswitch.org
+DefaultDirName=C:\FreeSWITCH
+DefaultGroupName=FreeSWITCH
+;LicenseFile=C:\source\wamp\license.txt
+OutputBaseFilename=freeswitch-1.0.4
+SetupIconFile=freeswitch.ico
+Compression=lzma
+SolidCompression=true
+AppCopyright=Anthony Minessale II
+AllowUNCPath=false
+OutputDir=Output
+
+[Languages]
+Name: english; MessagesFile: compiler:Default.isl
+
+[Tasks]
+Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+
+[Files]
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+Source: freeswitch.ico; DestDir: {app}; Components: FreeSWITCH
+Source: vcredist_x86.exe; Components: FreeSWITCH; DestDir: {tmp}
+Source: freepbx.ico; DestDir: {app}; Components: FreePBX_WAMP
+Source: expsound.bat; DestDir: {app}; Components: FreeSWITCH
+Source: FreePBX.url; DestDir: {app}; Components: FreePBX_WAMP
+Source: create_freepbx.sql; DestDir: {app}; Components: FreePBX_WAMP
+Source: create_freepbx.bat; DestDir: {app}; Components: FreePBX_WAMP
+Source: G:\freeswitch-1.0.4\Release\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist; Components: FreeSWITCH
+Source: G:\freeswitch-1.0.4\Release_CLR\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist; Components: FreeSWITCH
+Source: G:\freeswitch_dev\contrib\jmesquita\fsgui\bin\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist; Components: fsgui
+
+Source: G:\wamp_source\close\*.*; DestDir: {app}\wamp\; Flags: ignoreversion recursesubdirs; AfterInstall: close(); Components: FreePBX_WAMP
+Source: G:\wamp_source\wamp\*.*; DestDir: {app}\wamp\; Flags: ignoreversion recursesubdirs onlyifdoesntexist; Components: FreePBX_WAMP
+Source: G:\wamp_source\wamp\license.txt; DestDir: {app}\wamp\; AfterInstall: install(); Components: FreePBX_WAMP
+
+Source: G:\freeswitch_dev\Release\php_ESL.dll; DestDir: {app}\wamp\bin\php\php5.3.0\ext; Flags: ignoreversion recursesubdirs; Components: FreePBX_WAMP
+
+Source: G:\freepbx-v3-dev\*; DestDir: {app}\wamp\www\freepbx-v3; Flags: ignoreversion recursesubdirs onlyifdoesntexist createallsubdirs; Components: FreePBX_WAMP
+Source: G:\freepbx-v3-dev\INSTALL.TXT; DestDir: {app}\wamp\www\freepbx-v3; AfterInstall: fix_freepbx_paths(); Components: FreePBX_WAMP
+
+; These two files are required for TLS/SSL support
+Source: C:\OpenSSL\libeay32.dll; DestDir: {app}
+Source: C:\OpenSSL\ssleay32.dll; DestDir: {app}
+
+[Icons]
+Name: {group}\FreeSWITCH; Filename: {app}\FreeSwitch.exe; Components: FreeSWITCH; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}
+Name: {commondesktop}\FreeSWITCH; Filename: {app}\FreeSwitch.exe; Tasks: desktopicon; Components: FreeSWITCH; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\FreeSWITCH; Filename: {app}\FreeSwitch.exe; Tasks: quicklaunchicon; Components: FreeSWITCH; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}
+Name: {commondesktop}\fsgui; Filename: {app}\fsgui.exe; Tasks: desktopicon; Components: fsgui; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}\plugins
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\fsgui; Filename: {app}\fsgui.exe; Tasks: quicklaunchicon; Components: fsgui; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}\plugins
+
+Name: {commondesktop}\FreePBX.url; Filename: {app}\FreePBX.url; Tasks: desktopicon; Components: FreePBX_WAMP; IconFilename: {app}\freepbx.ico; IconIndex: 0
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\FreePBX.url; Filename: {app}\FreePBX.url; Tasks: quicklaunchicon; Components: FreePBX_WAMP; IconFilename: {app}\freepbx.ico; IconIndex: 0
+
+Name: {group}\start WampServer; Filename: {app}\wamp\wampmanager.exe; WorkingDir: {app}\wamp; Components: FreePBX_WAMP; Flags: runminimized
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\WampServer; Filename: {app}\wamp\wampmanager.exe; Tasks: quicklaunchicon; Components: FreePBX_WAMP
+Name: {commondesktop}\WampServer; Filename: {app}\wamp\wampmanager.exe; Tasks: desktopicon; Components: FreePBX_WAMP
+
+[Run]
+Filename: {tmp}\vcredist_x86.exe; Description: Microsoft Visual C++ 2008 Redistributable Package (x86); Components: FreeSWITCH; Parameters: /q
+
+Filename: {app}\wamp\uninstall_services.bat; Components: FreePBX_WAMP; Flags: runhidden
+Filename: {app}\wamp\install_services.bat; Components: FreePBX_WAMP; Flags: runhidden
+Filename: {app}\wamp\wampmanager.exe; Description: Launch WampServer 2 now; Components: FreePBX_WAMP; Flags: shellexec postinstall skipifsilent runhidden
+Filename: {app}\freeswitch.exe; Description: Launch FreeSWITCH now; Flags: shellexec postinstall skipifsilent; Components: FreeSWITCH
+
+Filename: {app}\create_freepbx.bat; Description: Create FreePBX MySQL user; Flags: runhidden; Components: FreePBX_WAMP; Parameters: {app}; WorkingDir: {app}
+
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz; Components: sound_files_8khz; WorkingDir: {tmp}
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-music-8000-1.0.8.tar.gz; Components: sound_files_8khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz; Components: sound_files_16khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-music-16000-1.0.8.tar.gz; Components: sound_files_16khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz; Components: sound_files_32khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-music-32000-1.0.8.tar.gz; Components: sound_files_32khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz; Components: sound_files_48khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-music-48000-1.0.8.tar.gz; Components: sound_files_48khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+
+[UninstallDelete]
+Type: filesandordirs; Name: {app}\sounds
+Type: files; Name: {app}\wamp\*.*
+Type: filesandordirs; Name: {app}\wamp\apps
+Type: filesandordirs; Name: {app}\wamp\bin\apache
+Type: filesandordirs; Name: {app}\wamp\bin\php
+Type: filesandordirs; Name: {app}\wamp\help
+Type: filesandordirs; Name: {app}\wamp\lang
+Type: filesandordirs; Name: {app}\wamp\logs
+Type: filesandordirs; Name: {app}\wamp\scripts
+Type: filesandordirs; Name: {app}\wamp\tmp
+Type: filesandordirs; Name: {app}
+
+[UninstallRun]
+Filename: {app}\wamp\uninstall_services.bat; Components: FreePBX_WAMP; Flags: runhidden
+Filename: {app}\freeswitch.exe; Flags: runhidden; Parameters: -stop; WorkingDir: {app}
+
+[_ISToolDownload]
+Source: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz; Components: sound_files_8khz
+Source: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz; Components: sound_files_16khz
+Source: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz; Components: sound_files_32khz
+Source: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz; Components: sound_files_48khz
+
+Source: http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.8.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-music-8000-1.0.8.tar.gz; Components: sound_files_8khz
+Source: http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.8.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-music-16000-1.0.8.tar.gz; Components: sound_files_16khz
+Source: http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.8.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-music-32000-1.0.8.tar.gz; Components: sound_files_32khz
+Source: http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.8.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-music-48000-1.0.8.tar.gz; Components: sound_files_48khz
+
+Source: http://files.freeswitch.org/downloads/win32/7za.exe; DestDir: {tmp}; DestName: 7za.exe; Components: sound_files_8khz
+[Components]
+Name: FreeSWITCH; Description: FreeSWITCH core components; Flags: fixed; Types: custom compact full; Languages: 
+Name: FreePBX_WAMP; Description: FreePBX interface along with Apache, Mysql and PHP; Types: custom full
+Name: fsgui; Description: fsgui (Joao Mesquita's QT based console); Types: custom full
+Name: sound_files_8khz; Description: sound files 8khz (G711); ExtraDiskSpaceRequired: 21000000; Types: custom compact full; Languages: 
+Name: sound_files_16khz; Description: sound files 16khz (G722); ExtraDiskSpaceRequired: 42000000; Types: custom full; Languages: 
+Name: sound_files_32khz; Description: sound files 32khz (CELT); ExtraDiskSpaceRequired: 82000000; Types: custom full; Languages: 
+Name: sound_files_48khz; Description: sound files 48khz (CELT); ExtraDiskSpaceRequired: 119000000; Types: custom full; Languages: 
+[Code]
+//variables globales
+var phpVersion: String;
+var apacheVersion: String;
+var path: String;
+var pathWithSlashes: String;
+var page: TInputQueryWizardPage;
+var email: String;
+var smtp: String;
+
+//-----------------------------------------------
+
+procedure expand_sound();
+var execFile: String;
+var myResult: Integer;
+var temppath: String;
+
+begin
+temppath := ExpandConstant('{tmp}');
+execFile := temppath+'\7za.exe';
+Exec(execFile, '',temppath+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
+end;
+
+procedure fix_freepbx_paths();
+var srcFile: String;
+var destFile: String;
+var srcContents: String;
+var fspath: String;
+var fspathWithSlashes: String;
+
+begin
+fspath := ExpandConstant('{app}');
+fspathWithSlashes := fspath;
+StringChange (fspathWithSlashes, '\','/');
+
+destFile := fspathWithSlashes+'/wamp/www/freepbx-v3/freepbx/config/telephony.php';
+//srcFile := fspathWithSlashes+'/wamp/www/freepbx-v3/freepbx/config/telephony.php.install';
+
+//if not FileExists (destFile) then
+//begin
+
+  LoadStringFromFile (destFile, srcContents);
+
+  StringChange (srcContents, '/opt/freeswitch', fspathWithSlashes);
+  StringChange (srcContents, '/usr/local/freeswitch', fspathWithSlashes);
+
+  SaveStringToFile(destFile,srcContents, False);
+//end
+
+//DeleteFile(SrcFile);
+
+end;
+
+
+//procedure qui ferme les eteind les services et ferme wampmanager.exe (si ils existent)
+
+procedure close();
+var batFile: String;
+var myResult: Integer;
+
+begin
+path := ExpandConstant('{app}') + '\wamp';
+batFile := path+'\closewamp.bat';
+Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
+
+
+end;
+
+
+//----------------------------------------------
+
+//procedure qui adapte WAMP aux choix effectu\xE9s lors de l'installation
+
+procedure install();
+var srcFile: String;
+var destFile: String;
+var srcContents: String;
+var browser: String;
+var winPath: String;
+var mysqlVersion: String;
+var wampserverVersion: String;
+var phpmyadminVersion: String;
+//var sqlitemanagerVersion: String;
+var tmp: String;
+var phpDllCopy: String;
+
+
+begin
+
+//version des applis, \xE0 modifier pour chaque version de WampServer 2
+apacheVersion := '2.2.11';
+phpVersion := '5.3.0' ;
+mysqlVersion := '5.1.36';
+wampserverVersion := '2.0';
+phpmyadminVersion := '3.2.0.1';
+//sqlitemanagerVersion := '1.2.0';
+
+
+path := ExpandConstant('{app}') + '\wamp';
+winPath := ExpandConstant('{win}');
+
+pathWithSlashes := path;
+StringChange (pathWithSlashes, '\','/');
+
+//----------------------------------------------
+// renommage du fichier c:/windows/php.ini
+//----------------------------------------------
+
+if FileExists ('c:/windows/php.ini') then
+begin
+  if MsgBox('A previous php.ini file has been detected in your Windows directory. Do you want WampServer2 to rename it to php_old.ini to avoid conflicts?',mbConfirmation,MB_YESNO) = IDYES then
+  begin
+    RenameFile('c:/windows/php.ini','c:/windows/php_old.ini');
+  end
+end
+
+
+
+
+//----------------------------------------------
+// Fichier install_services.bat
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/install_services.bat';
+srcFile := pathWithSlashes+'/install_services.bat.install';
+
+if not FileExists (pathWithSlashes+'/wampmanager.conf') then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //version de apache et mysql
+  StringChange (srcContents, 'WAMPMYSQLVERSION', mysqlVersion);
+  StringChange (srcContents, 'WAMPAPACHEVERSION', apacheVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  //dans le cas d'une upgrade on d\xE9truit le fichier pour qu'il ne soit pas execut\xE9
+  DeleteFile(destFile);
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier install_services_auto.bat
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/install_services_auto.bat';
+srcFile := pathWithSlashes+'/install_services_auto.bat.install';
+
+if not FileExists (pathWithSlashes+'/wampmanager.conf') then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //version de apache et mysql
+  StringChange (srcContents, 'WAMPMYSQLVERSION', mysqlVersion);
+  StringChange (srcContents, 'WAMPAPACHEVERSION', apacheVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  //dans le cas d'une upgrade on d\xE9truit le fichier pour qu'il ne soit pas execut\xE9
+  DeleteFile(destFile);
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier uninstall_services_auto.bat
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/uninstall_services.bat';
+srcFile := pathWithSlashes+'/uninstall_services.bat.install';
+
+if not FileExists (pathWithSlashes+'/wampmanager.conf') then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //version de apache et mysql
+  StringChange (srcContents, 'WAMPMYSQLVERSION', mysqlVersion);
+  StringChange (srcContents, 'WAMPAPACHEVERSION', apacheVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  //dans le cas d'une upgrade on d\xE9truit le fichier pour qu'il ne soit pas execut\xE9
+  DeleteFile(destFile);
+end
+DeleteFile(SrcFile);
+
+
+
+
+//----------------------------------------------
+// Fichier wampmanager.conf
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/wampmanager.conf';
+srcFile := pathWithSlashes+'/wampmanager.conf.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+
+  //installDir et versions
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPSERVERVERSION', wampserverVersion);
+  StringChange (srcContents, 'WAMPPHPVERSION', phpVersion);
+  StringChange (srcContents, 'WAMPMYSQLVERSION', mysqlVersion);
+  StringChange (srcContents, 'WAMPAPACHEVERSION', apacheVersion);
+  StringChange (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion);
+//  StringChange (srcContents, 'WAMPSQLITEMANAGERVERSION', sqlitemanagerVersion);
+
+
+
+  //navigateur
+  browser := 'explorer.exe';
+  if FileExists ('C:/Program Files/Mozilla Firefox/firefox.exe')  then
+  begin
+    if MsgBox('Firefox has been detected on your computer. Would you like to use it as the default browser with WampServer2?',mbConfirmation,MB_YESNO) = IDYES then
+    begin
+      browser := 'C:/Program Files/Mozilla Firefox/firefox.exe';
+    end
+  end
+  if browser = 'explorer.exe' then
+  begin
+    GetOpenFileName('Please choose your default browser. If you are not sure, just click Open :', browser, winPath,'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
+  end
+  StringChange (srcContents, 'WAMPBROWSER', browser);
+  SaveStringToFile(destFile,srcContents, False);
+end
+
+else
+begin
+// changement de wampserverVersion et WampserverVersion pour les upgrades
+end
+
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier wampmanager.ini
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/wampmanager.ini';
+srcFile := pathWithSlashes+'/wampmanager.ini.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+
+  //installDir et versions
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPPHPVERSION', phpVersion);
+  SaveStringToFile(destFile,srcContents, False);
+end
+
+DeleteFile(SrcFile);
+
+
+
+//----------------------------------------------
+// Fichier wampmanager.tpl
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/wampmanager.tpl';
+srcFile := pathWithSlashes+'/wampmanager.tpl.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+  SaveStringToFile(destFile,srcContents, False);
+end
+
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier alias phpmyadmin
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/alias/phpmyadmin.conf';
+srcFile := pathWithSlashes+'/alias/phpmyadmin.conf.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //installDir et version de phpmyadmin
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  LoadStringFromFile (srcFile, srcContents);
+
+  //installDir et version de phpmyadmin
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+
+
+  //mise \xE0 jour de la version de phpmyadmin
+  tmp := GetIniString('apps','phpmyadminVersion',phpmyadminVersion,pathWithSlashes+'/wampmanager.conf');
+  if not CompareText(tmp,phpmyadminVersion) = 0  then
+  begin
+    SetIniString('apps','phpmyadminVersion',phpmyadminVersion,pathWithSlashes+'/wampmanager.conf');
+    LoadStringFromFile (destFile, srcContents);
+    StringChange (srcContents, tmp, phpmyadminVersion);
+    SaveStringToFile(destFile,srcContents, False);
+  end
+end
+
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier de configuration de phpmyadmin
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
+srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
+
+if not FileExists (destFile) then
+begin
+
+// si un fichier existe pour une version precedente de phpmyadmin, on le recupere
+  if FileExists (pathWithSlashes+'/apps/phpmyadmin'+tmp+'/config.inc.php') then
+  begin
+    LoadStringFromFile (pathWithSlashes+'/apps/phpmyadmin'+tmp+'/config.inc.php', srcContents);
+    SaveStringToFile(destFile,srcContents, False);
+  end
+  else
+  begin
+
+// sinon on prends le fichier par defaut
+    LoadStringFromFile (srcFile, srcContents);
+    SaveStringToFile(destFile,srcContents, False);
+  end
+end
+
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier httpd.conf
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/conf/httpd.conf';
+srcFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/conf/httpd.conf.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //installDir et version de php
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPPHPVERSION', phpVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier my.ini
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/bin/mysql/mysql'+mysqlVersion+'/my.ini';
+srcFile := pathWithSlashes+'/bin/mysql/mysql'+mysqlVersion+'/my.ini.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //installDir et version de php
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier index.php
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/www/index.php';
+srcFile := pathWithSlashes+'/www/index.php.install';
+
+if not FileExists (destFile) then
+begin
+  LoadStringFromFile (srcFile, srcContents);
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  if MsgBox('Would you like to install the new WampServer 2 homepage? (this will overwrite exisiting index.php file)',mbConfirmation,MB_YESNO) = IDYES then
+  begin
+    DeleteFile (destFile);
+    LoadStringFromFile (srcFile, srcContents);
+    SaveStringToFile(destFile,srcContents, False);
+  end
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+//----------------------------------------------
+// Fichier php.ini
+//----------------------------------------------
+destFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini';
+
+if not FileExists (destFile) then
+begin
+   page := CreateInputQueryPage(wpInstalling,
+   'PHP mail parameters', '',
+   'Please specify the SMTP server and the adresse mail to be used by PHP when using the function mail(). If you are not sure, just leave the default values.');
+
+   page.Add('SMTP:', False);
+   page.Add('Email:', False);
+
+   // Valeurs par defaut
+   page.Values[0] := 'localhost';
+   page.Values[1] := 'you@yourdomain';
+   SaveStringToFile(pathWithSlashes+'/mailtag','tag', False);
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// copie des dll de php vers apache
+//----------------------------------------------
+
+phpDllCopy := 'fdftk.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'fribidi.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'gds32.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libeay32.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libmhash.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libmysql.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'msql.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libmysqli.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'ntwdblib.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'php5activescript.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'php5isapi.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'php5nsapi.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'ssleay32.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'yaz.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libmcrypt.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'php5ts.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+
+
+
+
+
+
+
+
+end;
+
+
+
+
+
+
+
+
+//-----------------------------------------------------------
+// gestion des fichiers php.ini
+
+procedure CurPageChanged(CurPageID: Integer);
+var destFile: String;
+var srcFile: String;
+var srcContents: String;
+begin
+  if CurPageID = 14 then
+  begin
+    if FileExists (pathWithSlashes+'/mailtag') then
+    begin
+      smtp := page.Values[0];
+      email := page.Values[1];
+      DeleteFile(pathWithSlashes+'/mailtag');
+    end
+    destFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini';
+    srcFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini.install';
+    LoadStringFromFile (srcFile, srcContents);
+    StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+    StringChange (srcContents, 'WAMPSMTP', smtp);
+    StringChange (srcContents, 'WAMPEMAIL', email);
+
+//----------------------------------------------
+// fichier php.ini dans php
+//----------------------------------------------
+
+
+
+    if not FileExists (destFile) then
+    begin
+      SaveStringToFile(destFile,srcContents, False);
+    end
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// fichier phpForApache.ini dans php
+//----------------------------------------------
+
+
+
+    destFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/phpForApache.ini';
+    if not FileExists (destFile) then
+    begin
+      SaveStringToFile(destFile,srcContents, False);
+    end
+
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// fichier php.ini dans apache
+//----------------------------------------------
+
+
+
+    destFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/php.ini';
+    if not FileExists (destFile) then
+    begin
+      SaveStringToFile(destFile,srcContents, False);
+    end
+
+  end
+
+  DeleteFile(SrcFile);
+
+
+
+
+
+
+//MsgBox(tmp,mbConfirmation,MB_YESNO);
+end;
+
+
+
+
+
+//-----------------------------------------------
+
+//procedure lanc\xE9e \xE0 la fin de l'installation, elle supprime les fichiers d'installation
+
+procedure DeinitializeSetup();
+
+begin
+  DeleteFile(path+'\install_services.bat');
+  DeleteFile(path+'\install_services_auto.bat');
+  DeleteFile(path+'\expsound.bat');
+  DeleteFile(path+'..\create_freepbx.bat');
+end;
+
+
+
+//-----------------------------------------------
+
+//procedure lanc\xE9e au d\xE9but de l'installation, elle alerte sur les upgrades de WampServer
+
+//function InitializeSetup(): Boolean;
+//begin
+//  Result := MsgBox('Important Information:' #13#13 'Please do not try to upgrade from WAMP5 1.x.' #13 ' If you have WAMP5 1.x installed, save your data, uninstall WAMP5 ' #13 'and delete the wamp folder before installing this new release. ' #13#13 'Do you want to continue install?', mbConfirmation, MB_YESNO) = idYes;
+//end;
+// Function generated by ISTool.
+function NextButtonClick(CurPage: Integer): Boolean;
+begin
+	Result := istool_download(CurPage);
+end;

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,837 @@
+; Script generated by the Inno Setup Script Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+;AppId={{088C2C50-0D5F-4276-8771-FF54CAA14E70}
+AppName=FreeSWITCH
+AppVerName=FreeSWITCH svn 15668
+AppPublisher=FreeSWITCH
+AppPublisherURL=http://www.freeswitch.org
+AppSupportURL=http://www.freeswitch.org
+AppUpdatesURL=http://www.freeswitch.org
+DefaultDirName=C:\FreeSWITCH
+DefaultGroupName=FreeSWITCH
+OutputBaseFilename=freeswitch
+SetupIconFile=freeswitch.ico
+Compression=lzma
+SolidCompression=true
+AppCopyright=Anthony Minessale II
+AllowUNCPath=false
+OutputDir=Output
+ArchitecturesInstallIn64BitMode=x64
+
+[Languages]
+Name: english; MessagesFile: compiler:Default.isl
+
+[Tasks]
+Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+
+[Files]
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+Source: freeswitch.ico; DestDir: {app}; Components: FreeSWITCH
+Source: vcredist_x86.exe; Flags: 32bit; Components: FreeSWITCH; DestDir: {tmp}; Check: not Is64BitInstallMode
+Source: vcredist_x64.exe; Flags: 64bit; Components: FreeSWITCH; DestDir: {tmp}; Check: Is64BitInstallMode
+Source: freepbx.ico; DestDir: {app}; Components: FreePBX_WAMP
+Source: expsound.bat; DestDir: {app}; Components: FreeSWITCH
+Source: FreePBX.url; DestDir: {app}; Components: FreePBX_WAMP
+Source: FusionPBX.url; DestDir: {app}; Components: FusionPBX_WAMP
+Source: create_freepbx.sql; DestDir: {app}; Components: FreePBX_WAMP
+Source: create_freepbx.bat; DestDir: {app}; Components: FreePBX_WAMP
+Source: create_fusionpbx.sql; DestDir: {app}; Components: FusionPBX_WAMP
+Source: create_fusionpbx.bat; DestDir: {app}; Components: FusionPBX_WAMP
+
+; 32 bit release
+Source: G:\freeswitch_dev\Release\*.exe; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: G:\freeswitch_dev\Release\*.dll; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: G:\freeswitch_dev\Release\*.lib; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: G:\freeswitch_dev\Release\mod\*; DestDir: {app}\mod; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: G:\freeswitch_dev\Release_CLR\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+; 64 bit release
+Source: G:\freeswitch_dev\x64\Release\*.exe; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: G:\freeswitch_dev\x64\Release\*.dll; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: G:\freeswitch_dev\x64\Release\*.lib; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: G:\freeswitch_dev\x64\Release\mod\*; DestDir: {app}\mod; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: G:\freeswitch_dev\x64\Release_CLR\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+
+; shared by 32 and 64 bit install
+Source: G:\freeswitch_dev\Release\conf\*; DestDir: {app}\conf; Flags: ignoreversion recursesubdirs createallsubdirs  onlyifdoesntexist; Components: FreeSWITCH
+Source: G:\freeswitch_dev\contrib\jmesquita\fsgui\bin\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist; Components: fsgui
+
+; WAMP
+Source: G:\wamp_source\close\*.*; DestDir: {app}\wamp\; Flags: ignoreversion recursesubdirs; AfterInstall: close(); Components: FreePBX_WAMP FusionPBX_WAMP; Tasks: 
+Source: G:\wamp_source\wamp\*.*; DestDir: {app}\wamp\; Flags: ignoreversion recursesubdirs onlyifdoesntexist; Components: FreePBX_WAMP FusionPBX_WAMP
+Source: G:\wamp_source\wamp\license.txt; DestDir: {app}\wamp\; AfterInstall: install_pbx(); Components: FreePBX_WAMP FusionPBX_WAMP
+
+Source: G:\freeswitch_dev\Release\php_ESL.dll; DestDir: {app}\wamp\bin\php\php5.3.0\ext; Flags: ignoreversion recursesubdirs; Components: FreePBX_WAMP FusionPBX_WAMP
+
+; FreePBX w/ svn folders
+Source: G:\freepbx-v3-dev\*; DestDir: {app}\wamp\www\freepbx-v3; Flags: ignoreversion recursesubdirs onlyifdoesntexist createallsubdirs; Components: FreePBX_WAMP
+Source: G:\freepbx-v3-dev\INSTALL.TXT; DestDir: {app}\wamp\www\freepbx-v3; AfterInstall: fix_freepbx_paths(); Components: FreePBX_WAMP
+
+; FusionPBX folders
+Source: G:\fusionpbx\*; DestDir: {app}\wamp\www\fusionpbx; Flags: ignoreversion recursesubdirs onlyifdoesntexist createallsubdirs; Components: FusionPBX_WAMP
+;Source: G:\fusionpbx\secure\*; DestDir: {app}\wamp\secure; Flags: ignoreversion recursesubdirs onlyifdoesntexist createallsubdirs; Components: FusionPBX_WAMP
+
+; These two files are required for TLS/SSL support
+; 32 bit version
+Source: C:\OpenSSL\libeay32.dll; DestDir: {app}; Check: not Is64BitInstallMode; Flags: 32bit
+Source: C:\OpenSSL\ssleay32.dll; DestDir: {app}; Check: not Is64BitInstallMode; Flags: 32bit
+; 64 bit version
+Source: C:\OpenSSL64\libeay32.dll; DestDir: {app}; Check: Is64BitInstallMode; Flags: 64bit
+Source: C:\OpenSSL64\ssleay32.dll; DestDir: {app}; Check: Is64BitInstallMode; Flags: 64bit
+
+
+[Dirs]
+Name: {app}\log
+Name: {app}\db
+Name: {app}\scripts
+Name: {app}\htdocs
+Name: {app}\grammar
+Name: {app}\backup
+Name: {app}\wamp\secure; Components: FusionPBX_WAMP
+
+[Icons]
+Name: {group}\FreeSWITCH; Filename: {app}\FreeSwitch.exe; Components: FreeSWITCH; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}
+Name: {commondesktop}\FreeSWITCH; Filename: {app}\FreeSwitch.exe; Tasks: desktopicon; Components: FreeSWITCH; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\FreeSWITCH; Filename: {app}\FreeSwitch.exe; Tasks: quicklaunchicon; Components: FreeSWITCH; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}
+Name: {commondesktop}\fsgui; Filename: {app}\fsgui.exe; Tasks: desktopicon; Components: fsgui; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}\plugins
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\fsgui; Filename: {app}\fsgui.exe; Tasks: quicklaunchicon; Components: fsgui; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}\plugins
+
+Name: {commondesktop}\FreePBX.url; Filename: {app}\FreePBX.url; Tasks: desktopicon; Components: FreePBX_WAMP; IconFilename: {app}\freepbx.ico; IconIndex: 0
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\FreePBX.url; Filename: {app}\FreePBX.url; Tasks: quicklaunchicon; Components: FreePBX_WAMP; IconFilename: {app}\freepbx.ico; IconIndex: 0
+
+Name: {commondesktop}\FusionPBX.url; Filename: {app}\FusionPBX.url; Tasks: desktopicon; Components: FusionPBX_WAMP
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\FusionPBX.url; Filename: {app}\FusionPBX.url; Tasks: quicklaunchicon; Components: FusionPBX_WAMP
+
+Name: {group}\start WampServer; Filename: {app}\wamp\wampmanager.exe; WorkingDir: {app}\wamp; Components: FreePBX_WAMP FusionPBX_WAMP; Flags: runminimized
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\WampServer; Filename: {app}\wamp\wampmanager.exe; Tasks: quicklaunchicon; Components: FreePBX_WAMP FusionPBX_WAMP
+Name: {commondesktop}\WampServer; Filename: {app}\wamp\wampmanager.exe; Tasks: desktopicon; Components: FreePBX_WAMP FusionPBX_WAMP
+
+[Run]
+Filename: {tmp}\vcredist_x86.exe; Description: Microsoft Visual C++ 2008 Redistributable Package (x86); Components: FreeSWITCH; Parameters: /q; Flags: 32bit; Check: not Is64BitInstallMode
+Filename: {tmp}\vcredist_x64.exe; Description: Microsoft Visual C++ 2008 Redistributable Package (x64); Components: FreeSWITCH; Parameters: /q; Flags: 64bit; Check: Is64BitInstallMode
+Filename: {app}\wamp\uninstall_services.bat; Components: FreePBX_WAMP FusionPBX_WAMP; Flags: runhidden
+Filename: {app}\wamp\install_services.bat; Components: FreePBX_WAMP FusionPBX_WAMP; Flags: runhidden
+Filename: {app}\wamp\wampmanager.exe; Description: Launch WampServer 2 now; Components: FreePBX_WAMP FusionPBX_WAMP; Flags: shellexec postinstall skipifsilent runhidden
+Filename: {app}\freeswitch.exe; Description: Launch FreeSWITCH now; Flags: shellexec postinstall skipifsilent; Components: FreeSWITCH
+
+Filename: {app}\create_freepbx.bat; Description: Create FreePBX MySQL user; Flags: runhidden; Components: FreePBX_WAMP; Parameters: {app}; WorkingDir: {app}
+Filename: {app}\create_fusionpbx.bat; Description: Create FusionPBX MySQL user; Flags: runhidden; Components: FusionPBX_WAMP; Parameters: {app}; WorkingDir: {app}
+
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz; Components: sound_files_8khz; WorkingDir: {tmp}
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-music-8000-1.0.8.tar.gz; Components: sound_files_8khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz; Components: sound_files_16khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-music-16000-1.0.8.tar.gz; Components: sound_files_16khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz; Components: sound_files_32khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-music-32000-1.0.8.tar.gz; Components: sound_files_32khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz; Components: sound_files_48khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+Filename: {app}\expsound.bat; Parameters: {tmp} {app} freeswitch-sounds-music-48000-1.0.8.tar.gz; Components: sound_files_48khz; WorkingDir: {tmp}; Tasks: ; Languages: 
+
+[UninstallDelete]
+Type: filesandordirs; Name: {app}\sounds
+Type: files; Name: {app}\wamp\*.*
+Type: filesandordirs; Name: {app}\wamp\apps
+Type: filesandordirs; Name: {app}\wamp\bin\apache
+Type: filesandordirs; Name: {app}\wamp\bin\php
+Type: filesandordirs; Name: {app}\wamp\help
+Type: filesandordirs; Name: {app}\wamp\lang
+Type: filesandordirs; Name: {app}\wamp\logs
+Type: filesandordirs; Name: {app}\wamp\scripts
+Type: filesandordirs; Name: {app}\wamp\tmp
+Type: filesandordirs; Name: {app}
+
+[UninstallRun]
+Filename: {app}\wamp\uninstall_services.bat; Components: FreePBX_WAMP FusionPBX_WAMP; Flags: runhidden
+Filename: {app}\freeswitch.exe; Flags: runhidden; Parameters: -stop; WorkingDir: {app}
+
+[_ISToolDownload]
+Source: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.12.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-en-us-callie-8000-1.0.11.tar.gz; Components: sound_files_8khz
+Source: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.12.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-en-us-callie-16000-1.0.11.tar.gz; Components: sound_files_16khz
+Source: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.12.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-en-us-callie-32000-1.0.11.tar.gz; Components: sound_files_32khz
+Source: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.12.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-en-us-callie-48000-1.0.11.tar.gz; Components: sound_files_48khz
+
+Source: http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.8.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-music-8000-1.0.8.tar.gz; Components: sound_files_8khz
+Source: http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.8.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-music-16000-1.0.8.tar.gz; Components: sound_files_16khz
+Source: http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.8.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-music-32000-1.0.8.tar.gz; Components: sound_files_32khz
+Source: http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.8.tar.gz; DestDir: {tmp}; DestName: freeswitch-sounds-music-48000-1.0.8.tar.gz; Components: sound_files_48khz
+
+Source: http://files.freeswitch.org/downloads/win32/7za.exe; DestDir: {tmp}; DestName: 7za.exe; Components: sound_files_8khz
+[Components]
+Name: FreeSWITCH; Description: FreeSWITCH core components; Flags: fixed; Types: custom compact full; Languages: 
+Name: FreePBX_WAMP; Description: FreePBX interface along with Apache, Mysql and PHP; Types: custom full; Flags: exclusive
+Name: FusionPBX_WAMP; Description: FusionPBX interface along with Apache, Mysql and PHP; Types: custom full; Flags: exclusive
+Name: fsgui; Description: fsgui (Joao Mesquita's QT based console); Types: custom full
+Name: sound_files_8khz; Description: sound files 8khz (G711); ExtraDiskSpaceRequired: 21000000; Types: custom compact full; Languages: 
+Name: sound_files_16khz; Description: sound files 16khz (G722); ExtraDiskSpaceRequired: 42000000; Types: custom full; Languages: 
+Name: sound_files_32khz; Description: sound files 32khz (CELT); ExtraDiskSpaceRequired: 82000000; Types: custom full; Languages: 
+Name: sound_files_48khz; Description: sound files 48khz (CELT); ExtraDiskSpaceRequired: 119000000; Types: custom full; Languages: 
+[Code]
+//variables globales
+var phpVersion: String;
+var apacheVersion: String;
+var path: String;
+var pathWithSlashes: String;
+var page: TInputQueryWizardPage;
+var email: String;
+var smtp: String;
+
+//-----------------------------------------------
+
+procedure expand_sound();
+var execFile: String;
+var myResult: Integer;
+var temppath: String;
+
+begin
+temppath := ExpandConstant('{tmp}');
+execFile := temppath+'\7za.exe';
+Exec(execFile, '',temppath+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
+end;
+
+procedure fix_freepbx_paths();
+var srcFile: String;
+var destFile: String;
+var srcContents: String;
+var fspath: String;
+var fspathWithSlashes: String;
+
+begin
+fspath := ExpandConstant('{app}');
+fspathWithSlashes := fspath;
+StringChange (fspathWithSlashes, '\','/');
+
+destFile := fspathWithSlashes+'/wamp/www/freepbx-v3/modules/freeswitch/config/freeswitch.php';
+//destFile := fspathWithSlashes+'/wamp/www/freepbx-v3/freepbx/config/telephony.php';
+//srcFile := fspathWithSlashes+'/wamp/www/freepbx-v3/freepbx/config/telephony.php.install';
+
+//if not FileExists (destFile) then
+//begin
+
+  LoadStringFromFile (destFile, srcContents);
+
+  StringChange (srcContents, '/opt/freeswitch', fspathWithSlashes);
+  StringChange (srcContents, '/usr/local/freeswitch', fspathWithSlashes);
+
+  SaveStringToFile(destFile,srcContents, False);
+//end
+
+//DeleteFile(SrcFile);
+
+end;
+
+//-----------------------------------------------
+
+//procedure qui ferme les eteind les services et ferme wampmanager.exe (si ils existent)
+
+procedure close();
+var batFile: String;
+var myResult: Integer;
+
+begin
+path := ExpandConstant('{app}') + '\wamp';
+batFile := path+'\closewamp.bat';
+Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
+
+
+end;
+
+//----------------------------------------------
+
+//procedure qui adapte WAMP aux choix effectu\xE9s lors de l'installation
+
+procedure install_pbx();
+var srcFile: String;
+var destFile: String;
+var srcContents: String;
+var browser: String;
+var winPath: String;
+var mysqlVersion: String;
+var wampserverVersion: String;
+var phpmyadminVersion: String;
+//var sqlitemanagerVersion: String;
+var tmp: String;
+var phpDllCopy: String;
+
+
+begin
+
+//version des applis, \xE0 modifier pour chaque version de WampServer 2
+apacheVersion := '2.2.11';
+phpVersion := '5.3.0' ;
+mysqlVersion := '5.1.36';
+wampserverVersion := '2.0';
+phpmyadminVersion := '3.2.0.1';
+//sqlitemanagerVersion := '1.2.0';
+
+
+path := ExpandConstant('{app}') + '\wamp';
+winPath := ExpandConstant('{win}');
+
+pathWithSlashes := path;
+StringChange (pathWithSlashes, '\','/');
+
+//----------------------------------------------
+// renommage du fichier c:/windows/php.ini
+//----------------------------------------------
+
+if FileExists ('c:/windows/php.ini') then
+begin
+  if MsgBox('A previous php.ini file has been detected in your Windows directory. Do you want WampServer2 to rename it to php_old.ini to avoid conflicts?',mbConfirmation,MB_YESNO) = IDYES then
+  begin
+    RenameFile('c:/windows/php.ini','c:/windows/php_old.ini');
+  end
+end
+
+
+
+
+//----------------------------------------------
+// Fichier install_services.bat
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/install_services.bat';
+srcFile := pathWithSlashes+'/install_services.bat.install';
+
+if not FileExists (pathWithSlashes+'/wampmanager.conf') then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //version de apache et mysql
+  StringChange (srcContents, 'WAMPMYSQLVERSION', mysqlVersion);
+  StringChange (srcContents, 'WAMPAPACHEVERSION', apacheVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  //dans le cas d'une upgrade on d\xE9truit le fichier pour qu'il ne soit pas execut\xE9
+  DeleteFile(destFile);
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier install_services_auto.bat
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/install_services_auto.bat';
+srcFile := pathWithSlashes+'/install_services_auto.bat.install';
+
+if not FileExists (pathWithSlashes+'/wampmanager.conf') then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //version de apache et mysql
+  StringChange (srcContents, 'WAMPMYSQLVERSION', mysqlVersion);
+  StringChange (srcContents, 'WAMPAPACHEVERSION', apacheVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  //dans le cas d'une upgrade on d\xE9truit le fichier pour qu'il ne soit pas execut\xE9
+  DeleteFile(destFile);
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier uninstall_services_auto.bat
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/uninstall_services.bat';
+srcFile := pathWithSlashes+'/uninstall_services.bat.install';
+
+if not FileExists (pathWithSlashes+'/wampmanager.conf') then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //version de apache et mysql
+  StringChange (srcContents, 'WAMPMYSQLVERSION', mysqlVersion);
+  StringChange (srcContents, 'WAMPAPACHEVERSION', apacheVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  //dans le cas d'une upgrade on d\xE9truit le fichier pour qu'il ne soit pas execut\xE9
+  DeleteFile(destFile);
+end
+DeleteFile(SrcFile);
+
+
+
+
+//----------------------------------------------
+// Fichier wampmanager.conf
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/wampmanager.conf';
+srcFile := pathWithSlashes+'/wampmanager.conf.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+
+  //installDir et versions
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPSERVERVERSION', wampserverVersion);
+  StringChange (srcContents, 'WAMPPHPVERSION', phpVersion);
+  StringChange (srcContents, 'WAMPMYSQLVERSION', mysqlVersion);
+  StringChange (srcContents, 'WAMPAPACHEVERSION', apacheVersion);
+  StringChange (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion);
+//  StringChange (srcContents, 'WAMPSQLITEMANAGERVERSION', sqlitemanagerVersion);
+
+
+
+  //navigateur
+  browser := 'explorer.exe';
+  if FileExists ('C:/Program Files/Mozilla Firefox/firefox.exe')  then
+  begin
+    if MsgBox('Firefox has been detected on your computer. Would you like to use it as the default browser with WampServer2?',mbConfirmation,MB_YESNO) = IDYES then
+    begin
+      browser := 'C:/Program Files/Mozilla Firefox/firefox.exe';
+    end
+  end
+  if browser = 'explorer.exe' then
+  begin
+    GetOpenFileName('Please choose your default browser. If you are not sure, just click Open :', browser, winPath,'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
+  end
+  StringChange (srcContents, 'WAMPBROWSER', browser);
+  SaveStringToFile(destFile,srcContents, False);
+end
+
+else
+begin
+// changement de wampserverVersion et WampserverVersion pour les upgrades
+end
+
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier wampmanager.ini
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/wampmanager.ini';
+srcFile := pathWithSlashes+'/wampmanager.ini.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+
+  //installDir et versions
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPPHPVERSION', phpVersion);
+  SaveStringToFile(destFile,srcContents, False);
+end
+
+DeleteFile(SrcFile);
+
+
+
+//----------------------------------------------
+// Fichier wampmanager.tpl
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/wampmanager.tpl';
+srcFile := pathWithSlashes+'/wampmanager.tpl.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+  SaveStringToFile(destFile,srcContents, False);
+end
+
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier alias phpmyadmin
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/alias/phpmyadmin.conf';
+srcFile := pathWithSlashes+'/alias/phpmyadmin.conf.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //installDir et version de phpmyadmin
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  LoadStringFromFile (srcFile, srcContents);
+
+  //installDir et version de phpmyadmin
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+
+
+  //mise \xE0 jour de la version de phpmyadmin
+  tmp := GetIniString('apps','phpmyadminVersion',phpmyadminVersion,pathWithSlashes+'/wampmanager.conf');
+  if not CompareText(tmp,phpmyadminVersion) = 0  then
+  begin
+    SetIniString('apps','phpmyadminVersion',phpmyadminVersion,pathWithSlashes+'/wampmanager.conf');
+    LoadStringFromFile (destFile, srcContents);
+    StringChange (srcContents, tmp, phpmyadminVersion);
+    SaveStringToFile(destFile,srcContents, False);
+  end
+end
+
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier de configuration de phpmyadmin
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
+srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
+
+if not FileExists (destFile) then
+begin
+
+// si un fichier existe pour une version precedente de phpmyadmin, on le recupere
+  if FileExists (pathWithSlashes+'/apps/phpmyadmin'+tmp+'/config.inc.php') then
+  begin
+    LoadStringFromFile (pathWithSlashes+'/apps/phpmyadmin'+tmp+'/config.inc.php', srcContents);
+    SaveStringToFile(destFile,srcContents, False);
+  end
+  else
+  begin
+
+// sinon on prends le fichier par defaut
+    LoadStringFromFile (srcFile, srcContents);
+    SaveStringToFile(destFile,srcContents, False);
+  end
+end
+
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier httpd.conf
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/conf/httpd.conf';
+srcFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/conf/httpd.conf.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //installDir et version de php
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+  StringChange (srcContents, 'WAMPPHPVERSION', phpVersion);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+DeleteFile(SrcFile);
+
+
+
+
+//----------------------------------------------
+// Fichier my.ini
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/bin/mysql/mysql'+mysqlVersion+'/my.ini';
+srcFile := pathWithSlashes+'/bin/mysql/mysql'+mysqlVersion+'/my.ini.install';
+
+if not FileExists (destFile) then
+begin
+
+  LoadStringFromFile (srcFile, srcContents);
+
+  //installDir et version de php
+  StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+
+  SaveStringToFile(destFile,srcContents, False);
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// Fichier index.php
+//----------------------------------------------
+
+destFile := pathWithSlashes+'/www/index.php';
+srcFile := pathWithSlashes+'/www/index.php.install';
+
+if not FileExists (destFile) then
+begin
+  LoadStringFromFile (srcFile, srcContents);
+  SaveStringToFile(destFile,srcContents, False);
+end
+else
+begin
+  if MsgBox('Would you like to install the new WampServer 2 homepage? (this will overwrite exisiting index.php file)',mbConfirmation,MB_YESNO) = IDYES then
+  begin
+    DeleteFile (destFile);
+    LoadStringFromFile (srcFile, srcContents);
+    SaveStringToFile(destFile,srcContents, False);
+  end
+end
+DeleteFile(SrcFile);
+
+
+
+
+
+//----------------------------------------------
+// Fichier php.ini
+//----------------------------------------------
+destFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini';
+
+if not FileExists (destFile) then
+begin
+   page := CreateInputQueryPage(wpInstalling,
+   'PHP mail parameters', '',
+   'Please specify the SMTP server and the adresse mail to be used by PHP when using the function mail(). If you are not sure, just leave the default values.');
+
+   page.Add('SMTP:', False);
+   page.Add('Email:', False);
+
+   // Valeurs par defaut
+   page.Values[0] := 'localhost';
+   page.Values[1] := 'you@yourdomain';
+   SaveStringToFile(pathWithSlashes+'/mailtag','tag', False);
+end
+
+
+
+//----------------------------------------------
+// copie des dll de php vers apache
+//----------------------------------------------
+
+phpDllCopy := 'fdftk.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'fribidi.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'gds32.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libeay32.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libmhash.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libmysql.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'msql.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libmysqli.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'ntwdblib.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'php5activescript.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'php5isapi.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'php5nsapi.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'ssleay32.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'yaz.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'libmcrypt.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+phpDllCopy := 'php5ts.dll';
+filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
+
+end;
+
+
+
+
+//-----------------------------------------------------------
+// gestion des fichiers php.ini
+
+procedure CurPageChanged(CurPageID: Integer);
+var destFile: String;
+var srcFile: String;
+var srcContents: String;
+begin
+  if CurPageID = 14 then
+  begin
+    if FileExists (pathWithSlashes+'/mailtag') then
+    begin
+      smtp := page.Values[0];
+      email := page.Values[1];
+      DeleteFile(pathWithSlashes+'/mailtag');
+    end
+    destFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini';
+    srcFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini.install';
+    LoadStringFromFile (srcFile, srcContents);
+    StringChange (srcContents, 'WAMPROOT', pathWithSlashes);
+    StringChange (srcContents, 'WAMPSMTP', smtp);
+    StringChange (srcContents, 'WAMPEMAIL', email);
+
+//----------------------------------------------
+// fichier php.ini dans php
+//----------------------------------------------
+
+
+
+    if not FileExists (destFile) then
+    begin
+      SaveStringToFile(destFile,srcContents, False);
+    end
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// fichier phpForApache.ini dans php
+//----------------------------------------------
+
+
+
+    destFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/phpForApache.ini';
+    if not FileExists (destFile) then
+    begin
+      SaveStringToFile(destFile,srcContents, False);
+    end
+
+
+
+
+
+
+
+
+
+
+//----------------------------------------------
+// fichier php.ini dans apache
+//----------------------------------------------
+
+
+
+    destFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/php.ini';
+    if not FileExists (destFile) then
+    begin
+      SaveStringToFile(destFile,srcContents, False);
+    end
+
+  end
+
+  DeleteFile(SrcFile);
+
+
+
+
+
+
+//MsgBox(tmp,mbConfirmation,MB_YESNO);
+end;
+
+
+
+
+
+//-----------------------------------------------
+
+//procedure lanc\xE9e \xE0 la fin de l'installation, elle supprime les fichiers d'installation
+
+procedure DeinitializeSetup();
+
+begin
+  DeleteFile(path+'\install_services.bat');
+  DeleteFile(path+'\install_services_auto.bat');
+  DeleteFile(path+'\expsound.bat');
+  DeleteFile(path+'..\create_freepbx.bat');
+  DeleteFile(path+'..\create_fusionbx.bat');
+end;
+
+
+
+//-----------------------------------------------
+
+//procedure lanc\xE9e au d\xE9but de l'installation, elle alerte sur les upgrades de WampServer
+
+//function InitializeSetup(): Boolean;
+//begin
+//  Result := MsgBox('Important Information:' #13#13 'Please do not try to upgrade from WAMP5 1.x.' #13 ' If you have WAMP5 1.x installed, save your data, uninstall WAMP5 ' #13 'and delete the wamp folder before installing this new release. ' #13#13 'Do you want to continue install?', mbConfirmation, MB_YESNO) = idYes;
+//end;
+// Function generated by ISTool.
+function NextButtonClick(CurPage: Integer): Boolean;
+begin
+	Result := istool_download(CurPage);
+end;

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/fsgui.iss

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/fsgui.iss (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/fsgui.iss) (0 => 15705)


--- freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/fsgui.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/fsgui.iss	2009-11-29 05:19:09 UTC (rev 15705)
@@ -0,0 +1,40 @@
+; Script generated by the Inno Setup Script Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+;AppId={{ED55656F-D567-4B3D-A0B9-617CAB13D519}
+AppName=FsGui
+AppVerName=FsGui svn 15668
+AppPublisherURL=http://wiki.freeswitch.org/wiki/Fsgui
+AppSupportURL=http://wiki.freeswitch.org/wiki/Fsgui
+AppUpdatesURL=http://wiki.freeswitch.org/wiki/Fsgui
+DefaultDirName=C:\FreeSWITCH
+DefaultGroupName=FreeSWITCH
+SetupIconFile=freeswitch.ico
+OutputBaseFilename=fsgui
+Compression=lzma
+SolidCompression=yes
+OutputDir=Output
+
+[Languages]
+Name: english; MessagesFile: compiler:Default.isl
+
+[Tasks]
+Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+
+[Files]
+
+Source: freeswitch.ico; DestDir: {app}
+Source: G:\freeswitch_dev\contrib\jmesquita\fsgui\bin\fsgui.exe; DestDir: {app}; Flags: ignoreversion
+Source: G:\freeswitch_dev\contrib\jmesquita\fsgui\bin\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+[Icons]
+Name: {group}\FsGui; Filename: {app}\fsgui.exe; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}\plugins
+Name: {commondesktop}\FsGui; Filename: {app}\fsgui.exe; Tasks: desktopicon; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}\plugins
+
+[Run]
+Filename: {app}\fsgui.exe; Description: {cm:LaunchProgram,FsGui}; Flags: nowait postinstall skipifsilent

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/vcredist_x64.exe

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/vcredist_x64.exe (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/vcredist_x64.exe)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/vcredist_x86.exe

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch_repair/w32/Setup/inno_setup/vcredist_x86.exe (from rev 15704, freeswitch/trunk/w32/Setup/inno_setup/vcredist_x86.exe)


(Binary files differ)