Revision
15701
Author
joshrivers
Date
2009-11-28 21:39:49 -0600 (Sat, 28 Nov 2009)

Log Message

Updating branch to HEAD.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.sln (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.sln	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.sln	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/Makefile.am (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/Makefile.am	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/Makefile.am	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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)

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

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

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/dir/sounds.xml (from rev 15700, freeswitch/trunk/conf/lang/ru/dir/sounds.xml) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/dir/sounds.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/dir/sounds.xml	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/conf/lang/ru/dir/tts.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/dir/tts.xml (from rev 15700, freeswitch/trunk/conf/lang/ru/dir/tts.xml) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/dir/tts.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/dir/tts.xml	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/conf/lang/ru/vm/sounds.xml (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/vm/sounds.xml	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/vm/sounds.xml	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes (from rev 15700, freeswitch/trunk/contrib/dvarnes)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java (from rev 15700, freeswitch/trunk/contrib/dvarnes/java)

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

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf (from rev 15700, freeswitch/trunk/contrib/sathieu/email2pdf)

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

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/README (from rev 15700, freeswitch/trunk/contrib/sathieu/email2pdf/README) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/README	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/README	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/contrib/sathieu/email2pdf/email2pdf

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/email2pdf (from rev 15700, freeswitch/trunk/contrib/sathieu/email2pdf/email2pdf) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/email2pdf	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/email2pdf	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/contrib/sathieu/email2pdf/header.html

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/header.html (from rev 15700, freeswitch/trunk/contrib/sathieu/email2pdf/header.html) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/header.html	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/header.html	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/freeswitch.spec (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/freeswitch.spec	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/freeswitch.spec	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/libs/libsndfile/configure.gnu (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libsndfile/configure.gnu	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libsndfile/configure.gnu	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/include/switch_caller.h (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_caller.h	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_caller.h	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/include/switch_core.h (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core.h	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core.h	2009-11-29 03:39:49 UTC (rev 15701)
@@ -1959,6 +1959,8 @@
 	switch_mutex_t *mutex;
 	switch_memory_pool_t *pool;
 	int32_t flags;
+	char creator[CACHE_DB_LEN];
+	char last_user[CACHE_DB_LEN];
 } switch_cache_db_handle_t;
 
 
@@ -1995,6 +1997,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/src/mod/applications/mod_cidlookup/mod_cidlookup.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/mod/applications/mod_commands/mod_commands.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_commands/mod_commands.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_commands/mod_commands.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/mod/applications/mod_lcr/mod_lcr.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_lcr/mod_lcr.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_lcr/mod_lcr.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/mod/applications/mod_limit/mod_limit.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_limit/mod_limit.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_limit/mod_limit.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/mod/applications/mod_voicemail/mod_voicemail.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_voicemail/mod_voicemail.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_voicemail/mod_voicemail.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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;
@@ -268,10 +267,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 +602,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,7 +614,6 @@
 
 	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;
 
 		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
@@ -776,6 +771,7 @@
 	}
 
   end:
+	switch_cache_db_release_db_handle(&dbh);
 	if (xml) {
 		switch_xml_free(xml);
 	}
@@ -1321,11 +1317,10 @@
 	vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
 	*total_saved_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_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);
@@ -4157,10 +4152,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/src/mod/endpoints/mod_sofia/sofia_glue.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_glue.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_glue.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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;
@@ -1149,7 +1166,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 +2361,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 +2561,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);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/switch_caller.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_caller.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_caller.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/switch_core_memory.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_memory.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_memory.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/src/switch_core_sqldb.c (15700 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_sqldb.c	2009-11-28 16:36:56 UTC (rev 15700)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_sqldb.c	2009-11-29 03:39:49 UTC (rev 15701)
@@ -188,18 +188,25 @@
 {
 	switch_thread_id_t self = switch_thread_self();
 	char thread_str[CACHE_DB_LEN] = "";
+	char db_callsite_str[CACHE_DB_LEN] = "";
 	switch_cache_db_handle_t *new_dbh = NULL;
 	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,12 +215,14 @@
 		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;
@@ -229,7 +238,9 @@
 				if (!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;
 				}
@@ -287,9 +298,10 @@
 		new_dbh->type = type;
 		switch_set_string(new_dbh->name, thread_str);
 		switch_set_flag(new_dbh, CDF_INUSE);
-		
+
 		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 +366,7 @@
 	char *p, *s, *e;
 	int chunk_count;
 	switch_size_t len;
-	
+
 	switch_assert(chunk_size);
 
 	if (err) *err = NULL;
@@ -379,23 +391,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 +424,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 +638,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);
 			}
 		}
@@ -1288,6 +1299,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

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup)

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

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/FreePBX.url (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/FreePBX.url) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/FreePBX.url	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/FreePBX.url	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/FusionPBX.url

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/FusionPBX.url (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/FusionPBX.url) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/FusionPBX.url	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/FusionPBX.url	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/create_freepbx.bat

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_freepbx.bat (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/create_freepbx.bat) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_freepbx.bat	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_freepbx.bat	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/create_freepbx.sql

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_freepbx.sql (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/create_freepbx.sql) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_freepbx.sql	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_freepbx.sql	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/create_fusionpbx.bat

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.bat (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/create_fusionpbx.bat) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.bat	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.bat	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/create_fusionpbx.sql

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.sql (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/create_fusionpbx.sql) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.sql	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.sql	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/expsound.bat

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/expsound.bat (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/expsound.bat) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/expsound.bat	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/expsound.bat	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/freepbx.ico

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


(Binary files differ)

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

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


(Binary files differ)

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

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_1.0.4.iss (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/freeswitch_1.0.4.iss) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_1.0.4.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_1.0.4.iss	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_freepbx_fusionpbx.iss	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/fsgui.iss

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fsgui.iss (from rev 15700, freeswitch/trunk/w32/Setup/inno_setup/fsgui.iss) (0 => 15701)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fsgui.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fsgui.iss	2009-11-29 03:39:49 UTC (rev 15701)
@@ -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/w32/Setup/inno_setup/vcredist_x64.exe

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


(Binary files differ)

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

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


(Binary files differ)